comparison sqlpyPlus.py @ 134:b532bc8430a6

completion is nice. i is proud.
author catherine@Elli.myhome.westell.com
date Wed, 27 Aug 2008 22:27:17 -0400
parents 25cbb45b190d
children 4c59f4a8b680
comparison
equal deleted inserted replaced
133:25cbb45b190d 134:b532bc8430a6
532 columnNames = columnNames.group(1) 532 columnNames = columnNames.group(1)
533 columnNames = [c.strip().upper() for c in columnNames.split(',')] 533 columnNames = [c.strip().upper() for c in columnNames.split(',')]
534 stmt1 = "SELECT table_name FROM all_tab_columns WHERE column_name = '%s' AND table_name LIKE '%s%%'" 534 stmt1 = "SELECT table_name FROM all_tab_columns WHERE column_name = '%s' AND table_name LIKE '%s%%'"
535 for columnName in columnNames: 535 for columnName in columnNames:
536 completions.extend(self.select_list(stmt1 % (columnName, text))) 536 completions.extend(self.select_list(stmt1 % (columnName, text)))
537 if segment in ('from', 'update') and (not completions): 537 if segment in ('from', 'update', 'insert into') and (not completions):
538 stmt = "SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%'" 538 stmt = "SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%'"
539 completions = self.select_list(stmt % (text)) 539 completions = self.select_list(stmt % (text))
540 if not completions: 540 if not completions:
541 stmt = """SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%' 541 stmt = """SELECT table_name FROM user_tables WHERE table_name LIKE '%s%%'
542 UNION 542 UNION
543 SELECT DISTINCT owner FROM all_tables WHERE owner LIKE '%%%s'""" 543 SELECT DISTINCT owner FROM all_tables WHERE owner LIKE '%%%s'"""
544 completions = self.select_list(stmt % (text, text)) 544 completions = self.select_list(stmt % (text, text))
545 if segment in ('where', 'group by', 'order by'): 545 if segment in ('where', 'group by', 'order by', 'having', 'set'):
546 try: 546 try:
547 owner, tableName = self.tableNameRegex.search(line).groups()[2:4] 547 owner, tableName = self.tableNameRegex.search(line).groups()[2:4]
548 except AttributeError: 548 except AttributeError:
549 return [] 549 return []
550 if owner: 550 if owner: