Commit Graph

95 Commits

Author SHA1 Message Date
Malcolm Tredinnick 4480645ac3 Fixed #8316 -- Put tighter restrictions on the type of Foreign Key fields
created for MySQL (because MySQL + InnoDB has those restrictions).
Patch from julianb.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 00:49:03 +00:00
Malcolm Tredinnick 71dda19184 Fixed #8597 -- Allow the use of strings containing underscores and percentage
signs in "iexact" queries on PostgreSQL again (this case was missed in [8536]).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 05:42:05 +00:00
Malcolm Tredinnick 220993bcc5 Added savepoint support to the transaction code.
This is a no-op for most databases. Only necessary on PostgreSQL so that we can
do things which will possibly intentionally raise an IntegrityError and not
have to rollback the entire transaction. Not supported for PostgreSQL versions
prior to 8.0, so should be used sparingly in internal Django code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:34:56 +00:00
Jacob Kaplan-Moss ab1a442a01 Fixed stupid syntax error in [8303].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:54:42 +00:00
Jacob Kaplan-Moss 5d837afe23 Fixed #8228: fixed a Python 2.3 compatibility from [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:24:44 +00:00
Russell Keith-Magee 9dc4ba875f Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 12:11:25 +00:00
Malcolm Tredinnick b7e74e5e56 Fixed #8028 -- A couple of small docstring fixes from [8131]. Thanks, Leo Soto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 03:16:39 +00:00
Malcolm Tredinnick b3b71a0922 Fixed #7560 -- Moved a lot of the value conversion preparation for
loading/saving interactions with the databases into django.db.backend. This
helps external db backend writers and removes a bunch of database-specific
if-tests in django.db.models.fields.

Great work from Leo Soto.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 05:09:29 +00:00
Malcolm Tredinnick 3b37c8151a Fixed #7411 -- worked around some possible transaction conflicts in SQLite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-15 18:47:32 +00:00
Malcolm Tredinnick 6048389391 Fixed #7532 -- Removed some dead code from the db backends. Thanks, Ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7852 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-06 14:26:37 +00:00
Malcolm Tredinnick f9df4d1435 Make sure we only create the minimum number of table indexes for MySQL.
This patch simplifies a bunch of code for all backends and removes some
duplicate index creation for MySQL, in particular (versions 4.x and later).
Patch from Nis Jørgensen.

Fixed #5671, #5680, #7170, #7186.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7790 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 04:46:59 +00:00
Adrian Holovaty 2b926d4222 Fixed #7319 -- Removed unused DatabaseFeatures attribute 'needs_upper_for_iops'. Thanks, leosoto
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7747 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:05:48 +00:00
Adrian Holovaty 06315375ce Fixed #7420 -- Abstracted some more database options into DatabaseFeatures -- supports_usecs, time_field_needs_date, interprets_empty_strings_as_nulls and date_field_supports_time_value -- and changed various hard-coded 'if DATABASE_BACKEND == oracle' statements to use the new options. Thanks to ramiro for the patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-16 03:15:04 +00:00
Adrian Holovaty ac5b9f5857 Fixed #7427 -- Fixed docstring that was rendered incorrect due to qs-rf. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7624 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 04:23:14 +00:00
Malcolm Tredinnick ba010ec1c0 Made some types of nested update queries very slightly more efficient at the
database level. Also worked around the fact that MySQL (and maybe other
backends we don't know about) cannot select from the table they're updating.

Fixed #7095.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 11:51:52 +00:00
Malcolm Tredinnick 9c52d56f6f Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.

Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 02:50:16 +00:00
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
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 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 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 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 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
Adrian Holovaty aab04a4c2f Refactored get_date_extract_sql() to DatabaseOperations.date_extract_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:40:06 +00:00
Adrian Holovaty 38b5d7f23d Began implementing BaseDatabaseOperations class for every database backend. This class will be used to hold the database-specific methods that currently live at the module level in each backend. Only autoinc_sql() has been implemented so far.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:29:57 +00:00
Adrian Holovaty 7c41b19c8a Refactored all database backends to inherit from a common base class to remove quite a bit of duplicated code. Thanks for the patch, Brian Harring. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 21:30:57 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00