summaryrefslogtreecommitdiff
path: root/plac/doc/sql_interface.py
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2010-07-12 10:25:57 +0200
committerMichele Simionato <michele.simionato@gmail.com>2010-07-12 10:25:57 +0200
commitd9cb2ba0701c884855900dadc95ede5b66d9fabf (patch)
tree581fa61ab0febcacd388099b170401ad4065668f /plac/doc/sql_interface.py
parent76e566e7fc5c55d8f03c24a2416b9583daeb3f07 (diff)
downloadmicheles-d9cb2ba0701c884855900dadc95ede5b66d9fabf.tar.gz
Fixed various bugs (see CHANGES.txt)
Diffstat (limited to 'plac/doc/sql_interface.py')
-rw-r--r--plac/doc/sql_interface.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/plac/doc/sql_interface.py b/plac/doc/sql_interface.py
index d045d03..ccedb97 100644
--- a/plac/doc/sql_interface.py
+++ b/plac/doc/sql_interface.py
@@ -11,8 +11,8 @@ class SqlInterface(object):
commands = ['SELECT']
def __init__(self, dsn):
self.soup = SqlSoup(dsn)
- def SELECT(self, *args):
- sql = 'SELECT ' + ' '.join(args)
+ def SELECT(self, argstring):
+ sql = 'SELECT ' + argstring
for row in self.soup.bind.execute(sql):
yield str(row) # the formatting can be much improved
@@ -21,5 +21,10 @@ rl_input = plac.ReadlineInput(
histfile=os.path.expanduser('~/.sql_interface.history'),
case_sensitive=False)
+def split_on_first_space(line, commentchar):
+ return line.strip().split(' ', 1) # ignoring comments
+
if __name__ == '__main__':
- plac.Interpreter(plac.call(SqlInterface)).interact(rl_input)
+ si = plac.call(SqlInterface)
+ i = plac.Interpreter(si, split=split_on_first_space)
+ i.interact(rl_input)