changeset 232:52adb09094b3

fixed bugs in VC introduced by sort-order options
author catherine@dellzilla
date Wed, 25 Feb 2009 17:45:35 -0500
parents 5728def6bdf5
children dc7683970717
files sqlpython/exampleSession.txt sqlpython/sqlpyPlus.py
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/exampleSession.txt	Wed Feb 25 17:10:45 2009 -0500
+++ b/sqlpython/exampleSession.txt	Wed Feb 25 17:45:35 2009 -0500
@@ -205,13 +205,13 @@
 autobind: False
 commit_on_exit: True
 echo: False
+editor: gedit
+heading: True
 maxfetch: 1000
 maxtselctrows: 10
+prompt: testschema@orcl>
 timeout: 30
-testschema@orcl> print
-testschema@orcl> set autobind on
-autobind - was: False
-now: True
+timing: False
 testschema@orcl> select * from play where author like 'A%';
 
 TITLE     AUTHOR   
--- a/sqlpython/sqlpyPlus.py	Wed Feb 25 17:10:45 2009 -0500
+++ b/sqlpython/sqlpyPlus.py	Wed Feb 25 17:45:35 2009 -0500
@@ -978,7 +978,7 @@
     def _ls_statement(self, arg, opts):
         if arg:
             target = arg.upper()
-            if opts.exact:
+            if hasattr(opts, 'exact') and opts.exact:
                 where = """\nWHERE object_name = '%s'
                              OR object_type || '/' || object_name = '%s'""" % \
                             (target, target)
@@ -992,16 +992,16 @@
         else:
             whose = 'user'
             objname = 'object_name'            
-        if opts.long:
+        if hasattr(opts, 'long') and opts.long:
             moreColumns = ', status, last_ddl_time'
         else:
             moreColumns = ''
             
         # 'Normal' sort order is DATE DESC (maybe), object type ASC, object name ASC
-        sortdirection = ('DESC' if opts.reverse else 'ASC')
+        sortdirection = ('DESC' if hasattr(opts, 'reverse') and opts.reverse else 'ASC')
         orderby = 'object_type %s, object_name %s' % (sortdirection, sortdirection)
-        if opts.timesort:
-            orderby = 'last_ddl_time %s, %s' % (('ASC' if opts.reverse else 'DESC'), orderby)
+        if hasattr(opts, 'timesort') and opts.timesort:
+            orderby = 'last_ddl_time %s, %s' % (('ASC' if hasattr(opts, 'reverse') and opts.reverse else 'DESC'), orderby)
         return {'objname': objname, 'moreColumns': moreColumns,
                 'whose': whose, 'where': where, 'orderby': orderby}