Ticket #6064: 6064.diff
File 6064.diff, 5.6 KB (added by , 17 years ago) |
---|
-
django/db/backends/ado_mssql/base.py
109 109 # TODO: Handle DATABASE_PORT. 110 110 conn_string = "PROVIDER=SQLOLEDB;DATA SOURCE=%s;UID=%s;PWD=%s;DATABASE=%s" % (settings.DATABASE_HOST, settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME) 111 111 self.connection = Database.connect(conn_string) 112 return self.connection.cursor() 112 cursor = self.connection.cursor() 113 for init_query in settings.CONNECTION_INIT_SQL: 114 cursor.execute(init_query) 115 return cursor -
django/db/backends/mysql_old/base.py
194 194 self.connection.set_character_set('utf8') 195 195 else: 196 196 cursor = self.connection.cursor() 197 for init_query in settings.CONNECTION_INIT_SQL: 198 cursor.execute(init_query) 197 199 return cursor 198 200 199 201 def make_debug_cursor(self, cursor): -
django/db/backends/postgresql/base.py
100 100 cursor = self.connection.cursor() 101 101 if set_tz: 102 102 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 103 for init_query in settings.CONNECTION_INIT_SQL: 104 cursor.execute(init_query) 103 105 cursor.execute("SET client_encoding to 'UNICODE'") 104 106 cursor = UnicodeCursorWrapper(cursor, 'utf-8') 105 107 return cursor -
django/db/backends/sqlite3/base.py
112 112 self.connection.create_function("django_extract", 2, _sqlite_extract) 113 113 self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) 114 114 self.connection.create_function("regexp", 2, _sqlite_regexp) 115 return self.connection.cursor(factory=SQLiteCursorWrapper) 115 cursor = self.connection.cursor(factory=SQLiteCursorWrapper) 116 for init_query in settings.CONNECTION_INIT_SQL: 117 cursor.execute(init_query) 118 return cursor 116 119 117 120 def close(self): 118 121 from django.conf import settings -
django/db/backends/mysql/base.py
181 181 kwargs.update(self.options) 182 182 self.connection = Database.connect(**kwargs) 183 183 cursor = self.connection.cursor() 184 for init_query in settings.CONNECTION_INIT_SQL: 185 cursor.execute(init_query) 184 186 return cursor 185 187 186 188 def _rollback(self): -
django/db/backends/oracle/base.py
432 432 # Set oracle date to ansi date format. 433 433 cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'") 434 434 cursor.execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'") 435 for init_query in settings.CONNECTION_INIT_SQL: 436 cursor.execute(init_query) 435 437 return cursor 436 438 437 439 class FormatStylePlaceholderCursor(Database.Cursor): -
django/db/backends/postgresql_psycopg2/base.py
73 73 cursor.tzinfo_factory = None 74 74 if set_tz: 75 75 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 76 for init_query in settings.CONNECTION_INIT_SQL: 77 cursor.execute(init_query) 76 78 return cursor -
django/conf/global_settings.py
120 120 DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. 121 121 DATABASE_OPTIONS = {} # Set to empty dictionary for default. 122 122 123 # List of sql statements to be executed at the beginning of every database connection. 124 CONNECTION_INIT_SQL = ( 125 # 'SET search_path TO example1, example2', 126 ) 127 123 128 # Host for sending e-mail. 124 129 EMAIL_HOST = 'localhost' 125 130 -
docs/settings.txt
269 269 The default number of seconds to cache a page when the caching middleware or 270 270 ``cache_page()`` decorator is used. 271 271 272 CONNECTION_INIT_SQL 273 ------------------- 274 275 Default: ``()`` (Empty tuple) 276 277 A list of sql statements to be executed at the beginning of every database connection. 278 279 For example, to set the database schema to 'django_application_schema' in postgresql, you 280 could set: 281 282 CONNECTION_INIT_SQL = ( 283 'SET search_path TO django_application_schema', 284 ) 285 272 286 DATABASE_ENGINE 273 287 --------------- 274 288