changeset 531:5c49b5a32687

MySQL table names are case sensitive
author catherine.devlin@gmail.com
date Fri, 08 Jul 2011 23:51:28 -0400
parents 853b9e675dd7
children 506156a9915e
files sqlpython/connections.py sqlpython/sqlpyPlus.py
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/connections.py	Wed Jun 29 21:18:02 2011 -0400
+++ b/sqlpython/connections.py	Fri Jul 08 23:51:28 2011 -0400
@@ -334,7 +334,7 @@
                         FROM   information_schema.tables
                         WHERE  table_schema %(owner_op)s LOWER(%(owner)S)
                         AND    table_type %(type_op)s UPPER(%(type)S)
-                        AND    table_name %(name_op)s LOWER(%(name)S)
+                        AND    table_name %(name_op)s %(name)S
                         ORDER BY table_schema, table_type, table_name %(sort_direction)s"""
     parameter_qry = """SHOW variables LIKE '%%%s%%'%s%s""" 
     gerald_types = {'TABLE': gerald.mysql_schema.Table,
--- a/sqlpython/sqlpyPlus.py	Wed Jun 29 21:18:02 2011 -0400
+++ b/sqlpython/sqlpyPlus.py	Fri Jul 08 23:51:28 2011 -0400
@@ -1135,15 +1135,14 @@
     def _do_dir(self, type, arg, opts):
         self._do_ls("%%/%s/%s%s%s" % (type, str(arg), arg.parsed.terminator, arg.parsed.suffix), opts)
 
-   
+
+    table_type_name = {'postgres': 'base table', 'mysql': 'BASE TABLE',
+                       'oracle': 'TABLE' }
     @options(standard_options)
     def do__dir_tables(self, arg, opts):
         'Shortcut for ``ls table/``'
-        if self.rdbms in ('postgres','mysql'):
-            target = 'base table'
-        else:
-            target = "table"
-        self._do_dir(target, arg, opts)
+        import pdb; pdb.set_trace()
+        self._do_dir(self.table_type_name[self.rdbms], arg, opts)
 
     @options(standard_options)
     def do__dir_views(self, arg, opts):