changeset 221:3a59ca05f980

added show parameter
author catherine@Elli.myhome.westell.com
date Fri, 30 Jan 2009 21:27:14 -0500
parents 01af6bfbe78f
children d8674ac61977
files sqlpython/sqlpyPlus.py
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/sqlpyPlus.py	Fri Jan 30 05:52:49 2009 -0500
+++ b/sqlpython/sqlpyPlus.py	Fri Jan 30 21:27:14 2009 -0500
@@ -585,6 +585,28 @@
         if opts.dump:
             statekeeper.restore()    
 
+    def do_show(self, arg):
+        '''
+        show                  - display value of all sqlpython parameters
+        show (parameter name) - display value of a sqlpython parameter
+        show parameter (parameter name) - display value of an ORACLE parameter
+        '''
+        if arg.startswith('param'):
+            try:
+                paramname = arg.split()[1].lower()
+            except IndexError:
+                paramname = ''
+            self.onecmd("""SELECT name, 
+                           CASE type WHEN 1 THEN 'BOOLEAN'
+                                     WHEN 2 THEN 'STRING'
+                                     WHEN 3 THEN 'INTEGER'
+                                     WHEN 4 THEN 'PARAMETER FILE'
+                                     WHEN 5 THEN 'RESERVED'
+                                     WHEN 6 THEN 'BIG INTEGER' END type, 
+                           value FROM v$parameter WHERE name LIKE '%%%s%%';""" % paramname)
+        else:
+            return Cmd.do_show(self, arg)
+            
     @options([make_option('-d', '--dump', action='store_true', help='dump results to files'),
               make_option('-f', '--full', action='store_true', help='get dependent objects as well'),
               make_option('-a', '--all', action='store_true', help="all schemas' objects"),