Mercurial > sqlpython
changeset 94:5df8e2477ca3
command-line args working
author | catherine@cordelia |
---|---|
date | Sun, 25 May 2008 05:22:34 -0400 |
parents | f40bb62c625f |
children | 84a26822e28c |
files | mysqlpy.py sqlpyPlus.py |
diffstat | 2 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mysqlpy.py Sun May 25 01:39:25 2008 -0400 +++ b/mysqlpy.py Sun May 25 05:22:34 2008 -0400 @@ -15,10 +15,13 @@ ''' MySqlPy V1.3 - 'sqlplus in python' Author: Luca.Canali@cern.ch -Rev: 1.3.0, 17-Oct-07 +Rev: 1.4.4, 28-May-08 Companion of SqlPython, a python module that reproduces Oracle's command line within python and sqlpyPlus. Major contributions by Catherine Devlin, http://catherinedevlin.blogspot.com + +Usage: sqlpython [connect string] [single-word command] ["multi-word command"]... + Quick start command list: - top -> executes a query to list all active sessions in (Oracle 10g and RAC) @@ -166,9 +169,9 @@ try: if sys.argv[1][0] != '@': my.do_connect(sys.argv.pop(1)) - arg = ' '.join(sys.argv[1:]) - if my.onecmd(arg): - return + for arg in sys.argv[1:]: + if my.onecmd(arg + ';') == my._STOP_AND_EXIT: + return except IndexError: pass my.cmdloop()
--- a/sqlpyPlus.py Sun May 25 01:39:25 2008 -0400 +++ b/sqlpyPlus.py Sun May 25 05:22:34 2008 -0400 @@ -326,7 +326,6 @@ pipeSeparator = Parser(pyparsing.SkipTo((pyparsing.Literal('|') ^ pyparsing.StringEnd()), include=True), retainSeparator=False) bindScanner = Parser(pyparsing.Literal(':') + pyparsing.Word( pyparsing.alphanums + "_$#" )) -commandSeparator = Parser(pyparsing.SkipTo((pyparsing.Literal(';') ^ pyparsing.StringEnd()), include=True)) def findBinds(target, existingBinds, givenBindVars = {}): result = givenBindVars