changeset 521:1dd6c8077bc7

fix missing paramstyle; still missing mysql
author catherine.devlin@gmail.com
date Wed, 10 Nov 2010 07:23:12 -0500
parents d7eaa2b0c25f
children 26bdff5abf78
files sqlpython/connections.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/connections.py	Wed Nov 10 07:01:28 2010 -0500
+++ b/sqlpython/connections.py	Wed Nov 10 07:23:12 2010 -0500
@@ -233,7 +233,7 @@
         else:
             identifier['sort_direction'] = 'ASC'
         curs = self.connection.cursor()
-        dbapiext.execute_f(curs, self.all_object_qry, **identifier)
+        dbapiext.execute_f(curs, self.all_object_qry, paramstyle=self.paramstyle, **identifier)
         return curs
     def columns(self, target, table_name, opts):
         target = self.sql_format_wildcards(target)
@@ -245,12 +245,12 @@
             identifier['owner'] = self.username
         self.set_operators(identifier)
         curs = self.connection.cursor()
-        dbapiext.execute_f(curs, self.column_qry, **identifier)
+        dbapiext.execute_f(curs, self.column_qry, paramstyle=self.paramstyle, **identifier)
         return curs
     def tables_and_views(self, target):
         identifier = {'table_name': target + '%'}
         curs = self.connection.cursor()
-        dbapiext.execute_f(curs, self.tables_and_views_qry, **identifier)
+        dbapiext.execute_f(curs, self.tables_and_views_qry, paramstyle=self.paramstyle, **identifier)
         return curs
     def _source(self, target, opts):
         identifier = {'text': '%%%s%%' % target.lower()}
@@ -260,7 +260,7 @@
             identifier['owner'] = self.username
         self.set_operators(identifier)
         curs = self.connection.cursor()
-        dbapiext.execute_f(curs, self.source_qry, **identifier)
+        dbapiext.execute_f(curs, self.source_qry, paramstyle=self.paramstyle, **identifier)
         return curs
     def source(self, target, opts):
         curs = self._source(target, opts)
@@ -300,6 +300,7 @@
 class MySQLInstance(DatabaseInstance):
     rdbms = 'mysql'
     default_port = 3306
+    paramstyle = ''
     def set_defaults(self):
         self.port = self.default_port       
         self.hostname = 'localhost'
@@ -342,6 +343,7 @@
     rdbms = 'postgres'
     default_port = 5432
     case = str.lower
+    paramstyle = 'format'
     def set_defaults(self):
         self.port = os.getenv('PGPORT') or self.default_port
         self.database = os.getenv('ORACLE_SID')
@@ -379,6 +381,7 @@
 class OracleInstance(DatabaseInstance):
     rdbms = 'oracle'
     default_port = 1521
+    paramstyle = 'named'
     connection_parser = re.compile('(?P<username>[^/\s@]*)(/(?P<password>[^/\s@]*))?(@((?P<hostname>[^/\s:]*)(:(?P<port>\d{1,4}))?/)?(?P<database>[^/\s:]*))?(\s+as\s+(?P<mode>sys(dba|oper)))?',
                                      re.IGNORECASE)
     def object_name_case(self, name):