# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1234903032 18000 # Node ID 6701c3f097f9a44fa3d538ee41fbf04b1833a8b3 # Parent 4ea2d2599dd4c45d16dd6ace4c4b4b44a178204b more comments diff -r 4ea2d2599dd4 -r 6701c3f097f9 sqlpython/mysqlpy.py --- 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) diff -r 4ea2d2599dd4 -r 6701c3f097f9 sqlpython/sqlpyPlus.py --- 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 ;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))