Ticket #3461: 3461-cursor-options.patch
File 3461-cursor-options.patch, 2.7 KB (added by , 16 years ago) |
---|
-
django/db/backends/postgresql/base.py
82 82 'iendswith': 'ILIKE %s', 83 83 } 84 84 85 def _cursor(self, settings ):85 def _cursor(self, settings, *args, **kwargs): 86 86 set_tz = False 87 87 if self.connection is None: 88 88 set_tz = True … … 100 100 conn_string += " port=%s" % settings.DATABASE_PORT 101 101 self.connection = Database.connect(conn_string, **self.options) 102 102 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 103 cursor = self.connection.cursor( )103 cursor = self.connection.cursor(*args, **kwargs) 104 104 if set_tz: 105 105 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 106 106 cursor.execute("SET client_encoding to 'UNICODE'") -
django/db/backends/mysql/base.py
165 165 self.connection = None 166 166 return False 167 167 168 def _cursor(self, settings ):168 def _cursor(self, settings, *args, **kwargs): 169 169 if not self._valid_connection(): 170 170 kwargs = { 171 171 'conv': django_conversions, … … 186 186 kwargs['port'] = int(settings.DATABASE_PORT) 187 187 kwargs.update(self.options) 188 188 self.connection = Database.connect(**kwargs) 189 cursor = self.connection.cursor( )189 cursor = self.connection.cursor(*args, **kwargs) 190 190 return cursor 191 191 192 192 def _rollback(self): -
django/db/backends/postgresql_psycopg2/base.py
50 50 'iendswith': 'ILIKE %s', 51 51 } 52 52 53 def _cursor(self, settings ):53 def _cursor(self, settings, *args, **kwargs): 54 54 set_tz = False 55 55 if self.connection is None: 56 56 set_tz = True … … 69 69 self.connection = Database.connect(conn_string, **self.options) 70 70 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 71 71 self.connection.set_client_encoding('UTF8') 72 cursor = self.connection.cursor( )72 cursor = self.connection.cursor(*args, **kwargs) 73 73 cursor.tzinfo_factory = None 74 74 if set_tz: 75 75 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])