comparison sqlpyPlus.py @ 138:3b3c78bad48f

need completion too
author catherine@Elli.myhome.westell.com
date Fri, 29 Aug 2008 09:54:12 -0400
parents c27eeeea8752
children 5a021524805a
comparison
equal deleted inserted replaced
137:c27eeeea8752 138:3b3c78bad48f
10 - SQL*Plus-style describe, spool 10 - SQL*Plus-style describe, spool
11 - write sends query result directly to file 11 - write sends query result directly to file
12 - comments shows table and column comments 12 - comments shows table and column comments
13 - compare ... to ... graphically compares results of two queries 13 - compare ... to ... graphically compares results of two queries
14 - commands are case-insensitive 14 - commands are case-insensitive
15 - context-sensitive tab-completion for table names, column names, etc.
15 16
16 Use 'help' within sqlpython for details. 17 Use 'help' within sqlpython for details.
17 18
18 Set bind variables the hard (SQL*Plus) way 19 Set bind variables the hard (SQL*Plus) way
19 exec :b = 3 20 exec :b = 3
528 if columnNames: 529 if columnNames:
529 columnNames = columnNames.group(1) 530 columnNames = columnNames.group(1)
530 columnNames = [c.strip().upper() for c in columnNames.split(',')] 531 columnNames = [c.strip().upper() for c in columnNames.split(',')]
531 stmt1 = "SELECT table_name FROM all_tab_columns WHERE column_name = '%s' AND table_name LIKE '%s%%'" 532 stmt1 = "SELECT table_name FROM all_tab_columns WHERE column_name = '%s' AND table_name LIKE '%s%%'"
532 for columnName in columnNames: 533 for columnName in columnNames:
534 # and if columnName is * ?
533 completions.extend(self.select_scalar_list(stmt1 % (columnName, text))) 535 completions.extend(self.select_scalar_list(stmt1 % (columnName, text)))
534 if segment in ('from', 'update', 'insert into') and (not completions): 536 if segment in ('from', 'update', 'insert into') and (not completions):
535 stmt = "SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%'" 537 stmt = "SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%'"
536 completions = self.select_scalar_list(stmt % (text)) 538 completions = self.select_scalar_list(stmt % (text))
537 if not completions: 539 if not completions: