changeset 229:411f78dc1e07

accept SET HEADING
author catherine@dellzilla
date Wed, 25 Feb 2009 15:08:32 -0500
parents 84905120d6c7
children e1e6b820f81b
files setup.py sqlpython/mysqlpy.py sqlpython/sqlpyPlus.py sqlpython/sqlpython.py
diffstat 4 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Fri Feb 20 11:52:08 2009 -0500
+++ b/setup.py	Wed Feb 25 15:08:32 2009 -0500
@@ -9,7 +9,7 @@
 Operating System :: OS Independent""".splitlines()
 
 setup(name="sqlpython",
-      version="1.5.2",
+      version="1.5.3",
       description="Command-line interface to Oracle",
       long_description="Customizable alternative to Oracle's SQL*PLUS command-line interface",
       author="Luca Canali",
@@ -17,7 +17,7 @@
       url="https://twiki.cern.ch/twiki/bin/view/PSSGroup/SqlPython",
       packages=find_packages(),
       include_package_data=True,    
-      install_requires=['pyparsing','cmd2>=0.4.5','cx_Oracle','genshi>=0.5'],
+      install_requires=['pyparsing','cmd2>=0.4.6','cx_Oracle','genshi>=0.5'],
       keywords = 'client oracle database',
       license = 'MIT',
       platforms = ['any'],
--- a/sqlpython/mysqlpy.py	Fri Feb 20 11:52:08 2009 -0500
+++ b/sqlpython/mysqlpy.py	Wed Feb 25 15:08:32 2009 -0500
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# MySqlPy V1.5.2
+# MySqlPy V1.5.3
 # Author: Luca.Canali@cern.ch
 # 
 #
@@ -13,9 +13,9 @@
 
 class mysqlpy(sqlpyPlus):
     '''
-MySqlPy V1.4.9 - 'sqlplus in python'
+MySqlPy V1.5.3 - 'sqlplus in python'
 Author: Luca.Canali@cern.ch
-Rev: 1.4.9, 26-Sep-08
+Rev: 1.5.3, 25-Feb-09
 
 Companion of SqlPython, a python module that reproduces Oracle's command line within python
 and sqlpyPlus. Major contributions by Catherine Devlin, http://catherinedevlin.blogspot.com
--- a/sqlpython/sqlpyPlus.py	Fri Feb 20 11:52:08 2009 -0500
+++ b/sqlpython/sqlpyPlus.py	Wed Feb 25 15:08:32 2009 -0500
@@ -364,11 +364,12 @@
     def __init__(self):
         sqlpython.sqlpython.__init__(self)
         self.binds = CaselessDict()
-        self.settable = 'autobind commit_on_exit echo maxfetch maxtselctrows timeout'.split()
+        self.settable = 'autobind commit_on_exit echo maxfetch maxtselctrows timeout heading'.split()
         # settables must be lowercase
         self.stdoutBeforeSpool = sys.stdout
         self.spoolFile = None
         self.autobind = False
+        self.heading = True
     #def default(self, arg):
     #    sqlpython.sqlpython.default(self, arg)
 
@@ -442,7 +443,7 @@
             plot.draw()
             return ''
         else:
-            result = sqlpython.pmatrix(self.rows, self.curs.description, self.maxfetch)
+            result = sqlpython.pmatrix(self.rows, self.curs.description, self.maxfetch, heading=self.heading)
         return result
         
     legalOracle = re.compile('[a-zA-Z_$#]')
--- a/sqlpython/sqlpython.py	Fri Feb 20 11:52:08 2009 -0500
+++ b/sqlpython/sqlpython.py	Wed Feb 25 15:08:32 2009 -0500
@@ -1,7 +1,7 @@
 #
-# SqlPython V1.5.2
+# SqlPython V1.5.3
 # Author: Luca.Canali@cern.ch, Apr 2006
-# Rev 29-May-08
+# Rev 25-Feb-09
 #
 # A python module to reproduce Oracle's command line 'sqlplus-like' within python
 # Intended to allow easy customizations and extentions 
@@ -10,7 +10,7 @@
 
 import cmd2,getpass,binascii,cx_Oracle,re,os
 import sqlpyPlus
-__version__ = '1.5.2'    
+__version__ = '1.5.3'    
 
 class sqlpython(cmd2.Cmd):
     '''A python module to reproduce Oracle's command line with focus on customization and extention'''
@@ -106,7 +106,7 @@
     do_exit = do_quit
     do_q = do_quit
     
-def pmatrix(rows,desc,maxlen=30):
+def pmatrix(rows,desc,maxlen=30,heading=True):
     '''prints a matrix, used by sqlpython to print queries' result sets'''
     names = []
     maxen = []
@@ -152,7 +152,8 @@
         toprint[j] = ' '.join(toprint[j])
     names = ' '.join(names)
     sepcols = ' '.join(sepcols)
-    toprint.insert(0, sepcols)
-    toprint.insert(0, names)
+    if heading:
+        toprint.insert(0, sepcols)
+        toprint.insert(0, names)
     return '\n'.join(toprint)