changeset 226:6701c3f097f9

more comments
author catherine@Elli.myhome.westell.com
date Tue, 17 Feb 2009 15:37:12 -0500
parents 4ea2d2599dd4
children 5cfa3eff8e4b
files sqlpython/mysqlpy.py sqlpython/sqlpyPlus.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/mysqlpy.py	Sat Feb 14 23:22:01 2009 -0500
+++ b/sqlpython/mysqlpy.py	Tue Feb 17 15:37:12 2009 -0500
@@ -140,6 +140,10 @@
 
     def do_explain(self,args):
         '''prints the plan of a given statement from the sql cache. 1 parameter: sql_id, see also do_sql '''
+        if len(args) > 2 and args[0].lower() == 'plan' and args[1].lower() == 'for':
+            self.curs.execute('explain %s' % ' '.join(args))
+            print 'Explained.  (see plan table)'
+            return 
         self.query = "select * from table(dbms_xplan.display_cursor('"+args+"'))"
         try:
             self.curs.execute(self.query)
--- a/sqlpython/sqlpyPlus.py	Sat Feb 14 23:22:01 2009 -0500
+++ b/sqlpython/sqlpyPlus.py	Tue Feb 17 15:37:12 2009 -0500
@@ -535,6 +535,7 @@
             print '\nSelected Max Num rows (%d)' % self.rc
         
     def do_cat(self, arg):
+        '''Shortcut for SELECT * FROM'''
         return self.do_select(self.parsed('SELECT * FROM %s;' % arg, 
                                           terminator = arg.parsed.terminator or ';', 
                                           suffix = arg.parsed.suffix))
@@ -632,7 +633,8 @@
               make_option('-m', '--message', action='store', type='string', dest='message', help="message to save to hg log during commit")])
     def do_hg(self, arg, opts):
         '''hg (opts) (objects):
-        Stores DDL on disk and puts files under Mercurial version control.'''
+        Stores DDL on disk and puts files under Mercurial version control.
+        Args specify which objects to store, same format as `ls`.'''
         self._vc(arg, opts, 'hg')        
 
     @options([
@@ -642,7 +644,8 @@
               make_option('-m', '--message', action='store', type='string', dest='message', help="message to save to hg log during commit")])
     def do_bzr(self, arg, opts):
         '''bzr (opts) (objects):
-        Stores DDL on disk and puts files under Bazaar version control.'''
+        Stores DDL on disk and puts files under Bazaar version control.
+        Args specify which objects to store, same format as `ls`.'''
         self._vc(arg, opts, 'bzr')        
 
     @options([
@@ -652,7 +655,8 @@
               make_option('-m', '--message', action='store', type='string', dest='message', help="message to save to hg log during commit")])
     def do_git(self, arg, opts):
         '''git (opts) (objects):
-        Stores DDL on disk and puts files under git version control.'''
+        Stores DDL on disk and puts files under git version control.
+        Args specify which objects to store, same format as `ls`.'''
         self._vc(arg, opts, 'git')        
         
     all_users_option = make_option('-a', action='store_const', dest="scope",
@@ -891,6 +895,9 @@
         self.do_select(self.parsed(sql, terminator=arg.parsed.terminator or ';', suffix=arg.parsed.suffix))
 
     def do_head(self, arg):
+        '''Shortcut for SELECT * FROM <arg>;10
+        The terminator (\\t, \\g, \\x, etc.) and number of rows can
+        be changed as for any other SELECT statement.'''
         sql = self.parsed('SELECT * FROM %s;' % arg, terminator=arg.parsed.terminator or ';', suffix=arg.parsed.suffix)
         sql.parsed['suffix'] = sql.parsed.suffix or '10'
         self.do_select(self.parsed(sql))