Mercurial > sqlpython
comparison sqlpython/sqlpython.py @ 518:69997c324eb9 1.7.2
1.7.2
author | Catherine Devlin <catherine.devlin@gmail.com> |
---|---|
date | Tue, 09 Nov 2010 05:41:08 -0500 |
parents | b7782506b5f3 |
children | 506156a9915e |
comparison
equal
deleted
inserted
replaced
517:c36e0aa695a4 | 518:69997c324eb9 |
---|---|
8 # Best used with the companion modules sqlpyPlus and mysqlpy | 8 # Best used with the companion modules sqlpyPlus and mysqlpy |
9 # See also http://twiki.cern.ch/twiki/bin/view/PSSGroup/SqlPython | 9 # See also http://twiki.cern.ch/twiki/bin/view/PSSGroup/SqlPython |
10 | 10 |
11 import cmd2,getpass,binascii,re,os,platform | 11 import cmd2,getpass,binascii,re,os,platform |
12 import pyparsing, connections | 12 import pyparsing, connections |
13 __version__ = '1.7.0' | 13 __version__ = '1.7.2' |
14 try: | 14 try: |
15 import cx_Oracle | 15 import cx_Oracle |
16 except ImportError: | 16 except ImportError: |
17 cx_Oracle = None | 17 cx_Oracle = None |
18 try: | 18 try: |
118 help='add connection (keep current connection)'), | 118 help='add connection (keep current connection)'), |
119 cmd2.make_option('-c', '--close', action='store_true', | 119 cmd2.make_option('-c', '--close', action='store_true', |
120 help='close connection {N} (or current)'), | 120 help='close connection {N} (or current)'), |
121 cmd2.make_option('-C', '--closeall', action='store_true', | 121 cmd2.make_option('-C', '--closeall', action='store_true', |
122 help='close all connections'), | 122 help='close all connections'), |
123 cmd2.make_option('--postgresql', action='store_true', help='Connect to postgreSQL: `connect --postgresql [DBNAME [USERNAME]]`'), | |
123 cmd2.make_option('--postgres', action='store_true', help='Connect to postgreSQL: `connect --postgres [DBNAME [USERNAME]]`'), | 124 cmd2.make_option('--postgres', action='store_true', help='Connect to postgreSQL: `connect --postgres [DBNAME [USERNAME]]`'), |
124 cmd2.make_option('--oracle', action='store_true', help='Connect to an Oracle database'), | 125 cmd2.make_option('--oracle', action='store_true', help='Connect to an Oracle database'), |
125 cmd2.make_option('--mysql', action='store_true', help='Connect to a MySQL database'), | 126 cmd2.make_option('--mysql', action='store_true', help='Connect to a MySQL database'), |
126 cmd2.make_option('-H', '--hostname', type='string', | 127 cmd2.make_option('-H', '--hostname', type='string', |
127 help='Machine where database is hosted'), | 128 help='Machine where database is hosted'), |
140 connect oracle://user:password@SID | 141 connect oracle://user:password@SID |
141 connect postgres://user:password@hostname/dbname | 142 connect postgres://user:password@hostname/dbname |
142 connect user/password@SID (Oracle is the default RDBMS target) | 143 connect user/password@SID (Oracle is the default RDBMS target) |
143 connect --postgres --hostname=hostname dbname username | 144 connect --postgres --hostname=hostname dbname username |
144 connect --mysql dbname username''' | 145 connect --mysql dbname username''' |
146 opts.postgres = opts.postgres or opts.postgresql | |
145 if opts.closeall: | 147 if opts.closeall: |
146 self.closeall() | 148 self.closeall() |
147 return | 149 return |
148 if opts.close: | 150 if opts.close: |
149 if not arg: | 151 if not arg: |