Ticket #1051: ticket_1051_rev6669.diff
File ticket_1051_rev6669.diff, 4.4 KB (added by , 17 years ago) |
---|
-
django/conf/project_template/settings.py
11 11 12 12 DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 13 13 DATABASE_NAME = '' # Or path to database file if using sqlite3. 14 DATABASE_SCHEMAS = '' # Databse schemas to be used. Only used in PostgreSQL 14 15 DATABASE_USER = '' # Not used with sqlite3. 15 16 DATABASE_PASSWORD = '' # Not used with sqlite3. 16 17 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -
django/conf/global_settings.py
112 112 # Database connection info. 113 113 DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. 114 114 DATABASE_NAME = '' # Or path to database file if using sqlite3. 115 DATABASE_SCHEMAS = '' # Databse schemas to be used. Only used in PostgreSQL 115 116 DATABASE_USER = '' # Not used with sqlite3. 116 117 DATABASE_PASSWORD = '' # Not used with sqlite3. 117 118 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -
django/db/backends/postgresql/base.py
81 81 82 82 def _cursor(self, settings): 83 83 set_tz = False 84 set_path = False 84 85 if self.connection is None: 85 86 set_tz = True 86 87 if settings.DATABASE_NAME == '': … … 95 96 conn_string += " host=%s" % settings.DATABASE_HOST 96 97 if settings.DATABASE_PORT: 97 98 conn_string += " port=%s" % settings.DATABASE_PORT 99 if settings.DATABASE_SCHEMAS: 100 set_path = True 98 101 self.connection = Database.connect(conn_string, **self.options) 99 102 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 100 103 cursor = self.connection.cursor() 101 104 if set_tz: 102 105 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 106 if set_path: 107 cursor.execute("SET search_path TO %s" % ','.join(settings.DATABASE_SCHEMAS)) 103 108 cursor.execute("SET client_encoding to 'UNICODE'") 104 109 cursor = UnicodeCursorWrapper(cursor, 'utf-8') 105 110 return cursor -
django/db/backends/postgresql_psycopg2/base.py
50 50 51 51 def _cursor(self, settings): 52 52 set_tz = False 53 set_path = False 53 54 if self.connection is None: 54 55 set_tz = True 55 56 if settings.DATABASE_NAME == '': … … 64 65 conn_string += " host=%s" % settings.DATABASE_HOST 65 66 if settings.DATABASE_PORT: 66 67 conn_string += " port=%s" % settings.DATABASE_PORT 68 if settings.DATABASE_SCHEMAS: 69 set_path = True 67 70 self.connection = Database.connect(conn_string, **self.options) 68 71 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 69 72 self.connection.set_client_encoding('UTF8') … … 71 74 cursor.tzinfo_factory = None 72 75 if set_tz: 73 76 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 77 if set_path: 78 cursor.execute("SET search_path TO %s" % ','.join(settings.DATABASE_SCHEMAS)) 74 79 return cursor -
docs/settings.txt
322 322 323 323 The username to use when connecting to the database. Not used with SQLite. 324 324 325 DATABASE_SCHEMAS 326 ---------------- 327 328 Default: ``''`` (Empty string) 329 330 On databases supporting schemas this is the schemas to be used. 331 332 Note that currently the only backend with schema support is PostgreSQL. 333 325 334 DATE_FORMAT 326 335 ----------- 327 336