[open-ils-commits] r769 - servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Feb 7 18:12:27 EST 2010
Author: gfawcett
Date: 2010-02-07 18:12:20 -0500 (Sun, 07 Feb 2010)
New Revision: 769
Modified:
servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/base.py
servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/introspection.py
Log:
deleted superfluous code from new pg backend.
Modified: servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/base.py
===================================================================
--- servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/base.py 2010-02-07 22:46:16 UTC (rev 768)
+++ servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/base.py 2010-02-07 23:12:20 UTC (rev 769)
@@ -21,34 +21,3 @@
schemas = getattr(settings, 'DATABASE_PG_SCHEMAS', ['public'])
cursor.execute('set search_path to %s;' % ','.join(schemas))
return cursor
-
- set_tz = False
- settings_dict = self.settings_dict
- if self.connection is None:
- set_tz = True
- if settings_dict['DATABASE_NAME'] == '':
- from django.core.exceptions import ImproperlyConfigured
- raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
- conn_string = "dbname=%s" % settings_dict['DATABASE_NAME']
- if settings_dict['DATABASE_USER']:
- conn_string = "user=%s %s" % (settings_dict['DATABASE_USER'], conn_string)
- if settings_dict['DATABASE_PASSWORD']:
- conn_string += " password='%s'" % settings_dict['DATABASE_PASSWORD']
- if settings_dict['DATABASE_HOST']:
- conn_string += " host=%s" % settings_dict['DATABASE_HOST']
- if settings_dict['DATABASE_PORT']:
- conn_string += " port=%s" % settings_dict['DATABASE_PORT']
- self.connection = Database.connect(conn_string, **settings_dict['DATABASE_OPTIONS'])
- self.connection.set_isolation_level(1) # make transactions transparent to all cursors
- connection_created.send(sender=self.__class__)
- cursor = self.connection.cursor()
- if set_tz:
- cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
- if not hasattr(self, '_version'):
- self.__class__._version = get_version(cursor)
- if self._version[0:2] < (8, 0):
- # No savepoint support for earlier version of PostgreSQL.
- self.features.uses_savepoints = False
- cursor.execute("SET client_encoding to 'UNICODE'")
- cursor = UnicodeCursorWrapper(cursor, 'utf-8')
- return cursor
Modified: servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/introspection.py
===================================================================
--- servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/introspection.py 2010-02-07 22:46:16 UTC (rev 768)
+++ servres/branches/eg-schema-experiment/conifer/evergreen/backends/postgresql_with_schemas/introspection.py 2010-02-07 23:12:20 UTC (rev 769)
@@ -5,25 +5,6 @@
class DatabaseIntrospection(PostgresDatabaseIntrospection):
- def get_relations(self, cursor, table_name):
- """
- Returns a dictionary of {field_index: (field_index_other_table, other_table)}
- representing all relationships to the given table. Indexes are 0-based.
- """
- cursor.execute("""
- SELECT con.conkey, con.confkey, c2.relname
- FROM pg_constraint con, pg_class c1, pg_class c2
- WHERE c1.oid = con.conrelid
- AND c2.oid = con.confrelid
- AND c1.relname = %s
- AND con.contype = 'f'""", [table_name])
- relations = {}
- for row in cursor.fetchall():
- # row[0] and row[1] are single-item lists, so grab the single item.
- relations[row[0][0] - 1] = (row[1][0] - 1, row[2])
- return relations
-
-
def get_table_list(self, cursor):
"Returns a list of table names in the current database."
schemas = ','.join("'%s'" % s for s in SCHEMAS)
More information about the open-ils-commits
mailing list