Ticket #5947: minimal_sql2005_syncdb.patch
File minimal_sql2005_syncdb.patch, 2.1 KB (added by , 17 years ago) |
---|
-
base.py
22 22 # We need to use a special Cursor class because adodbapi expects question-mark 23 23 # param style, but Django expects "%s". This cursor converts question marks to 24 24 # format-string style. 25 class C ursor(Database.Cursor):26 def executeHelper(self, operation, isStoredProcedureCall, parameters=None):25 class ConvertParamsToQuestionMarkCursor(Database.Cursor): 26 def _executeHelper(self, operation, isStoredProcedureCall, parameters=None): 27 27 if parameters is not None and "%s" in operation: 28 28 operation = operation.replace("%s", "?") 29 Database.Cursor. executeHelper(self, operation, isStoredProcedureCall, parameters)29 Database.Cursor._executeHelper(self, operation, isStoredProcedureCall, parameters) 30 30 31 class Connection(Database.Connection):32 def cursor(self):33 return Cursor(self)34 Database.Connection = Connection35 36 31 origCVtoP = Database.convertVariantToPython 37 32 def variantToPython(variant, adType): 38 33 if type(variant) == bool and adType == 11: … … 109 104 # TODO: Handle DATABASE_PORT. 110 105 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 106 self.connection = Database.connect(conn_string) 112 return self.connection.cursor()107 return ConvertParamsToQuestionMarkCursor(self.connection) -
introspection.py
1 1 def 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()] 3 5 4 6 def get_table_description(cursor, table_name): 5 7 raise NotImplementedError