Ticket #5947: minimal_sql2005_syncdb.patch

File minimal_sql2005_syncdb.patch, 2.1 KB (added by Adam Vandenberg, 16 years ago)
  • base.py

     
    2222# We need to use a special Cursor class because adodbapi expects question-mark
    2323# param style, but Django expects "%s". This cursor converts question marks to
    2424# format-string style.
    25 class Cursor(Database.Cursor):
    26     def executeHelper(self, operation, isStoredProcedureCall, parameters=None):
     25class ConvertParamsToQuestionMarkCursor(Database.Cursor):
     26    def _executeHelper(self, operation, isStoredProcedureCall, parameters=None):
    2727        if parameters is not None and "%s" in operation:
    2828            operation = operation.replace("%s", "?")
    29         Database.Cursor.executeHelper(self, operation, isStoredProcedureCall, parameters)
     29        Database.Cursor._executeHelper(self, operation, isStoredProcedureCall, parameters)
    3030
    31 class Connection(Database.Connection):
    32     def cursor(self):
    33         return Cursor(self)
    34 Database.Connection = Connection
    35 
    3631origCVtoP = Database.convertVariantToPython
    3732def variantToPython(variant, adType):
    3833    if type(variant) == bool and adType == 11:
     
    109104            # TODO: Handle DATABASE_PORT.
    110105            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)
    111106            self.connection = Database.connect(conn_string)
    112         return self.connection.cursor()
     107        return ConvertParamsToQuestionMarkCursor(self.connection)
  • introspection.py

     
    11def get_table_list(cursor):
    2     raise NotImplementedError
     2    "Returns a list of table names in the current database."
     3    cursor.execute("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'")
     4    return [row[0] for row in cursor.fetchall()]
    35
    46def get_table_description(cursor, table_name):
    57    raise NotImplementedError
Back to Top