changeset 184:e863f6f67408

work on commenting
author catherine@Elli.myhome.westell.com
date Sat, 08 Nov 2008 17:13:21 -0500
parents 34d895615a94
children
files sqlpython/sqlpyPlus.py
diffstat 1 files changed, 21 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/sqlpyPlus.py	Sat Nov 08 11:09:35 2008 -0500
+++ b/sqlpython/sqlpyPlus.py	Sat Nov 08 17:13:21 2008 -0500
@@ -354,9 +354,7 @@
     defaultExtension = 'sql'
     sqlpython.sqlpython.shortcuts.update({':': 'setbind', 
                                           '\\': 'psql', 
-                                          '@': '_load',
-                                          '--': '_comment',
-                                          '/*': '_multiline_comment'})
+                                          '--': '_comment'})
     multilineCommands = '''select insert update delete tselect
                       create drop alter _multiline_comment'''.split()
     defaultFileName = 'afiedt.buf'
@@ -389,11 +387,6 @@
         return cmd, arg, line
     
     do__load = Cmd.do_load
-    
-    def do__comment(self, arg):
-        pass
-    def do__multiline_comment(self, arg):
-        pass
 
     def onecmd_plus_hooks(self, line):                          
         line = self.precmd(line)
@@ -539,32 +532,26 @@
         if override_terminator:
             statement['terminator'] = override_terminator
         statement['rowlimit'] = int(statement.rowlimit or 0)
-        try:
-            self.varsUsed = findBinds(self.query, self.binds, bindVarsIn)
-            self.curs.execute(self.query, self.varsUsed)
-            self.rows = self.curs.fetchmany(min(self.maxfetch, (statement.rowlimit or self.maxfetch)))
-            self.desc = self.curs.description
-            self.rc = self.curs.rowcount
-            if self.rc > 0:
-                self.stdout.write('\n%s\n' % (self.output(statement.terminator, statement.rowlimit)))
-            if self.rc == 0:
-                print '\nNo rows Selected.\n'
-            elif self.rc == 1: 
-                print '\n1 row selected.\n'
-                if self.autobind:
-                    self.binds.update(dict(zip([''.join(l for l in d[0] if l.isalnum()) for d in self.desc], self.rows[0])))
-                    for (i, val) in enumerate(self.rows[0]):
-                        varname = ''.join(letter for letter in self.desc[i][0] if letter.isalnum() or letter == '_')
-                        self.binds[varname] = val
-                        self.binds[str(i+1)] = val
-            elif self.rc < self.maxfetch:
-                print '\n%d rows selected.\n' % self.rc
-            else:
-                print '\nSelected Max Num rows (%d)' % self.rc
-        except Exception, e:
-            print e
-            import traceback
-            traceback.print_exc(file=sys.stdout)
+        self.varsUsed = findBinds(self.query, self.binds, bindVarsIn)
+        self.curs.execute(self.query, self.varsUsed)
+        self.rows = self.curs.fetchmany(min(self.maxfetch, (statement.rowlimit or self.maxfetch)))
+        self.rc = self.curs.rowcount
+        if self.rc > 0:
+            self.stdout.write('\n%s\n' % (self.output(statement.terminator, statement.rowlimit)))
+        if self.rc == 0:
+            print '\nNo rows Selected.\n'
+        elif self.rc == 1: 
+            print '\n1 row selected.\n'
+            if self.autobind:
+                self.binds.update(dict(zip([''.join(l for l in d[0] if l.isalnum()) for d in self.curs.description], self.rows[0])))
+                for (i, val) in enumerate(self.rows[0]):
+                    varname = ''.join(letter for letter in self.curs.description[i][0] if letter.isalnum() or letter == '_')
+                    self.binds[varname] = val
+                    self.binds[str(i+1)] = val
+        elif self.rc < self.maxfetch:
+            print '\n%d rows selected.\n' % self.rc
+        else:
+            print '\nSelected Max Num rows (%d)' % self.rc
         self.sqlBuffer.append(self.query)