Commit Graph

129 Commits

Author SHA1 Message Date
Malcolm Tredinnick 595e75e8dd Fixed #5729 -- For MySQL (only), always delay the creation of foreign key
references, for all tables, until after the table has been created. This means
that when using the InnoDB storage engine, true foreign key constraints are
created (inline "REFERENCES" are ignored by InnoDB, unfortunately).

Fully backwards compatible.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 05:05:24 +00:00
Adrian Holovaty c599de2ac6 Added a BaseDatabaseOperations.last_executed_query() hook, which allows a database backend to specify how to get the last-executed query on a given cursor. Implemented it for the psycopg2 backend. This means that for psycopg2, the SQL statements in django.db.connection.queries will now reflect the exact SQL as sent to the server, instead of a naive and misleading string-interpolated version
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 19:00:31 +00:00
Gary Wilson Jr 73f495158c Fixed #5710 -- Fixed a missing table name quoting in the postgresql backend, thanks davep@atomicdroplet.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 05:53:56 +00:00
Jacob Kaplan-Moss 980fa8b827 Fixed #231: all fields that should take max_length now do. Thanks, Don Spaulding.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-19 23:33:57 +00:00
Ian Kelly 8c5214d9b4 Made Oracle backend cast CharField values of None to u'' instead of ''
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 23:23:55 +00:00
Jacob Kaplan-Moss 4c0ac53ff8 Fixed a missing import in mysql backend. Thanks for pointing it out, mattmcc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 23:02:39 +00:00
Ian Kelly 17cd87a264 Fixed an Oracle sqlflush / sequence reset column name bug exposed by the new test case in [6195].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6230 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 22:07:54 +00:00
Adrian Holovaty dfdbf9ec1e Fixed #5161 -- Changed MySQL backend only to report warning once. Thanks, durdinator
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 22:05:58 +00:00
Ian Kelly f180d95903 Fixed #4896: fixed #4765: Patch for cursor.executemany using oracle and
sqlite3. Thanks, jdetaeye@www.frepple.com


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 21:32:25 +00:00
Matt Boersma a6b1d65e33 Fixed #5226. Now we check the Oracle version and give an explicit
error when we encounter a regex operator that isn't supported on 9i or 
earlier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:26:07 +00:00
Ian Kelly 93f60163e8 Fixed #5218: Made Oracle create autoinc triggers using the correct name
of the AutoField column rather than always assume "ID".


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:12:36 +00:00
Adrian Holovaty f36e96cc9c Added django/db/backends/creation.py, with BaseCreation. Refs #5461
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 16:44:53 +00:00
Malcolm Tredinnick 134bf3a26b Backed out [6165]. It breaks things for people using psycopg2 because it requires psycopg to also be installed due to imports.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 06:21:25 +00:00
Gary Wilson Jr 30b24a6cce Refs #4299 -- Removed some code duplication in the postgresql introspection modules by letting the `postgresql_psycopg2` backend use identical functions from the `postgresql` backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 05:33:39 +00:00
Adrian Holovaty 41576fea71 Fixed #5263 -- Updated docstring for sqlite3 backend. Thanks, Paul Bx
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-02 20:04:44 +00:00
Adrian Holovaty 8b8a36c7d0 Changed postgresql and postgresql_psycopg2 backends NOT to do a SELECT version() for every connection, which was ludicrous. Now the version is only retrieved if it needs to be, via a lazy loader.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 19:24:47 +00:00
Adrian Holovaty 861b28f37e Fixed #5055 -- Changed Postgres DatabaseOperations.sql_flush() to use 'SELECT setval()' instead of 'ALTER SEQUENCE', because the latter only works with Postgres 7.3+. Thanks, Don Arbow
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:56:43 +00:00
Adrian Holovaty 6d387d3d1b Fixed #5255 -- It's now possible again to use Django without a database. This had temporarily gotten buggy after the django.core.management refactoring last week
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:27:57 +00:00
Matt Boersma 377fe7ce77 Fixed breakage of test suite for Oracle by adding a null check.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-21 17:06:06 +00:00
Adrian Holovaty b367ec2244 Made various negligible formatting cleanups to the database backends
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:32:06 +00:00
Adrian Holovaty 14db37319b Refactored OPERATOR_MAPPING so that it exists as django.db.connection.operators instead of django.db.backend.OPERATOR_MAPPING. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:26:55 +00:00
Adrian Holovaty b3912d3609 Changed backend create_test_db() and destroy_test_db() hooks NOT to take the backend as an argument, as the backend as an object is going away
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:16:55 +00:00
Adrian Holovaty e267bec83a Simplified max_name_length() call in oracle database backend
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:10:20 +00:00
Adrian Holovaty b105a52882 Refactored get_drop_sequence() to DatabaseOperations.drop_sequence_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:08:32 +00:00
Adrian Holovaty 4c5248f98f Refactored get_field_cast_sql() to DatabaseOperations.field_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:03:40 +00:00
Adrian Holovaty e13ea3c70d Refactored get_query_set_class() to DatabaseOperations.query_set_class(). Also added BaseDatabaseFeatures.uses_custom_queryset. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:39:05 +00:00
Adrian Holovaty 6d8e6090e5 Removed a bunch of legacy django.db.backend imports
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5975 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:28:40 +00:00
Adrian Holovaty 1a8f9b2b97 Implemented BaseDatabaseFeatures and changed all code to access it -- connection.features.foo instead of backend.foo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:20:33 +00:00
Adrian Holovaty 4f82250512 Removed unneeded import from postgresql_psycopg2/base.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:30:11 +00:00
Adrian Holovaty f4b397087c Moved postgresql backend DatabaseOperations class into a new module, postgresql/operations.py, so that it can be imported by both the postgresql and postgresql_psycopg2 backends. Hence the two backends no longer have a duplicated DatabaseOperations class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:26:46 +00:00
Adrian Holovaty c2c3e93096 Removed _dict_helper() DB backend helper function, as it wasn't being used anymore
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:15:32 +00:00
Adrian Holovaty a6a5e3cf32 Removed backend.dictfetchall(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:53 +00:00
Adrian Holovaty ba49e7be08 Removed backend.dictfetchmany(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5969 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:03 +00:00
Adrian Holovaty 1b4cfd4fea Removed backend.dictfetchone(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:13:12 +00:00
Adrian Holovaty 221f99ed58 Refactored quote_name() to DatabaseOperations.quote_name(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:03:33 +00:00
Adrian Holovaty d4f218bd91 Refactored get_tablespace_sql() to DatabaseOperations.tablespace_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:30:19 +00:00
Adrian Holovaty 13061bf20b Refactored get_start_transaction_sql() to DatabaseOperations.start_transaction_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:24:03 +00:00
Adrian Holovaty 147e99a08a Refactored get_sql_sequence_reset() to DatabaseOperations.sequence_reset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:21:10 +00:00
Adrian Holovaty aaed6e04ec Refactored get_sql_flush() to DatabaseOperations.sql_flush(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:15:53 +00:00
Adrian Holovaty c44fb66551 Refactored get_random_function_sql() to DatabaseOperations.random_function_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5962 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:04:20 +00:00
Adrian Holovaty aaf8760227 Refactored get_pk_default_value() to DatabaseOperations.pk_default_value(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:59:06 +00:00
Adrian Holovaty e4b7e369dd Refactored get_max_name_length() to DatabaseOperations.max_name_length(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:53:39 +00:00
Adrian Holovaty d3e69c3a47 Refactored get_limit_offset_sql() to DatabaseOperations.limit_offset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:24:59 +00:00
Adrian Holovaty 5ce050a5f5 Refactored get_last_insert_id() to DatabaseOperations.last_insert_id(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:18:43 +00:00
Adrian Holovaty 5a6426448f Refactored get_fulltext_search_sql() to DatabaseOperations.fulltext_search_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:13:06 +00:00
Adrian Holovaty 23a736dca9 Refactored get_drop_foreignkey_sql() to DatabaseOperations.drop_foreignkey_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:07:34 +00:00
Adrian Holovaty 8e84d35d38 Refactored get_deferrable_sql() to DatabaseOperations.deferrable_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:03:38 +00:00
Adrian Holovaty ed8e392f77 Added extra documentation to BaseDatabaseOperations.datetime_cast_sql() docstring
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:57:08 +00:00
Adrian Holovaty 29f67dce9e Refactored get_datetime_cast_sql() to DatabaseOperations.datetime_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:55:05 +00:00
Adrian Holovaty 5f51f0524a Refactored get_date_trunc_sql() to DatabaseOperations.date_trunc_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:47:43 +00:00