deleted superfluous code from new pg backend.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 7 Feb 2010 23:12:20 +0000 (23:12 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 7 Feb 2010 23:12:20 +0000 (23:12 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/branches/eg-schema-experiment@769 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/evergreen/backends/postgresql_with_schemas/base.py
conifer/evergreen/backends/postgresql_with_schemas/introspection.py

index 0a36cbc..e9ff1b8 100755 (executable)
@@ -21,34 +21,3 @@ class DatabaseWrapper(DatabaseWrapper):
         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
index 50d8306..2ed0fdc 100755 (executable)
@@ -5,25 +5,6 @@ SCHEMAS = getattr(settings, 'DATABASE_PG_SCHEMAS', ['public'])
 
 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)