Ticket #2358: mssql.diff
File mssql.diff, 3.1 KB (added by , 18 years ago) |
---|
-
django/db/backends/ado_mssql/base.py
70 70 # TODO: Handle DATABASE_PORT. 71 71 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) 72 72 self.connection = Database.connect(conn_string) 73 cursor = self.connection.cursor()73 cursor = Cursor(self.connection) 74 74 if settings.DEBUG: 75 75 return util.CursorDebugWrapper(cursor, self) 76 76 return cursor … … 117 117 118 118 def get_limit_offset_sql(limit, offset=None): 119 119 # TODO: This is a guess. Make sure this is correct. 120 sql = "LIMIT %s" % limit 121 if offset and offset != 0: 122 sql += " OFFSET %s" % offset 123 return sql 120 # should be "SELECT TOP %s" % limit 121 # not LIMIT at the end 122 return "" 123 #sql = "LIMIT %s" % limit 124 #if offset and offset != 0: 125 # sql += " OFFSET %s" % offset 126 #return sql 124 127 125 128 def get_random_function_sql(): 126 129 return "RAND()" -
django/db/backends/ado_mssql/introspection.py
1 1 def get_table_list(cursor): 2 raise NotImplementedError 2 cursor.execute('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES') 3 return [row[0] for row in cursor.fetchall()] 3 4 4 5 def get_table_description(cursor, table_name): 5 6 raise NotImplementedError -
django/db/models/base.py
172 172 record_exists = True 173 173 if pk_set: 174 174 # Determine whether a record with the primary key already exists. 175 cursor.execute("SELECT 1 FROM %s WHERE %s=%%s LIMIT 1" % \175 cursor.execute("SELECT 1 FROM %s WHERE %s=%%s" % \ 176 176 (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)), [pk_val]) 177 177 # If it does already exist, do an UPDATE. 178 178 if cursor.fetchone(): -
django/db/models/fields/__init__.py
478 478 if value is not None: 479 479 # MySQL will throw a warning if microseconds are given, because it 480 480 # doesn't support microseconds. 481 if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'):481 if settings.DATABASE_ENGINE == 'mysql' or settings.DATABASE_ENGINE == 'ado_mssql' and hasattr(value, 'microsecond'): 482 482 value = value.replace(microsecond=0) 483 483 value = str(value) 484 484 return Field.get_db_prep_save(self, value)