Commit Graph

402 Commits

Author SHA1 Message Date
Simon Charette 766afc22a1 Fixed #24793 -- Unified temporal difference support. 2016-02-26 12:25:12 -05:00
zshimanchik 65aa94200b Fixed #24653 -- Fixed MySQL database introspection when using read_default_file. 2016-02-26 12:02:13 -05:00
Tim Graham 004ba0f99e Removed unneeded hint=None/obj=None in system check messages. 2016-02-12 13:01:25 -05:00
userimack 60586dd737 Fixed #26125 -- Fixed E731 flake warnings. 2016-01-25 14:23:43 -05:00
Tim Graham 4dc74371e3 Removed unused attributes of MySQL SchemaEditor. 2016-01-22 12:46:27 -05:00
Alexander Sosnovskiy 2a7ce34600 Fixed #14286 -- Added models.BigAutoField. 2015-12-25 20:01:31 -05:00
Stewart Park b7fdd60d85 Fixed #24675 -- Skipped SQL_AUTO_IS_NULL query on MySQL if not needed. 2015-12-15 10:30:57 -05:00
George Marshall 710e11d076 Fixed #25767 -- Fixed data truncation possibility with Positive(Small)IntegerField on MySQL. 2015-11-24 11:09:15 -05:00
Tim Graham abcdb237bb Refs #25196 -- Fixed incorrect argument order in test database creation. 2015-11-13 11:29:35 -05:00
Mariusz Felisiak 0f6d51e6a0 Fixed #25470 -- Avoided unnecessary, expensive DATETIME typecast on MySQL. 2015-10-21 19:24:19 -04:00
Ville Skyttä afe777639c Fixed #25196 -- Normalized database representations in test database messages.
Left over Oracle mostly as-is since it's more complicated.
2015-09-25 10:21:55 -04:00
Alex Hill 134ca4d438 Fixed #24509 -- Added Expression support to SQLInsertCompiler 2015-09-22 23:35:24 +10:00
Ville Skyttä 4d933ad418 Fixed #25393 -- Fixed MySQL crash when adding text/blob field with unhashable default. 2015-09-14 12:25:08 -04:00
Aymeric Augustin 33c7c2a557 Enabled parallel testing by default in runtests.py. 2015-09-10 13:34:05 +02:00
Aymeric Augustin 0586c061f0 Cloned databases for running tests in parallel. 2015-09-09 23:01:15 +02:00
Tim Graham aaacaeb096 Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
2015-06-24 16:08:20 -04:00
Adam Brenecki 65296b3be3 Fixed #24972 -- Fixed removing unique_together indexes on MySQL. 2015-06-15 17:28:13 -04:00
Jon Dufresne 44f3ee7716 Fixed #9596 -- Added date transform for DateTimeField. 2015-06-02 08:49:10 -04:00
Adam Chainz e60cce4e40 Fixed #24846 -- Added support to MySQL SchemaEditor for all blob/text data types 2015-05-30 20:37:57 -04:00
Andriy Sokolovskiy 80ad5472ce Fixed #24817 -- Prevented loss of null info in MySQL field renaming. 2015-05-28 10:07:52 -04:00
Aymeric Augustin ed83881e64 Fixed #23820 -- Supported per-database time zone.
The primary use case is to interact with a third-party database (not
primarily managed by Django) that doesn't support time zones and where
datetimes are stored in local time when USE_TZ is True.

Configuring a PostgreSQL database with the TIME_ZONE option while USE_TZ
is False used to result in silent data corruption. Now this is an error.
2015-05-17 09:40:28 +02:00
Aymeric Augustin 54026f1e8d Renamed value_to_db_xxx to adapt_xxxfield_value.
This mirrors convert_xxxfield_value nicely, taking advantage of the
adapter/converter terminology which is commonly used by DB-API modules.
2015-05-17 09:39:34 +02:00
Aymeric Augustin d9521f66b1 Removed global timezone-aware datetime adapters.
Refs #23820.

Fixed #19738.

Refs #17755. In order not to introduce a regression for raw queries,
parameters are passed through the connection.ops.value_to_db_* methods,
depending on their type.
2015-05-17 09:38:48 +02:00
Aymeric Augustin fe6b5e62b1 Normalized the implementation of get_db_converters.
Put the types in the same order and checked for None consistently.
2015-05-17 09:36:27 +02:00
Aymeric Augustin ec186572e6 Removed global timezone-aware datetime converters.
Refs #23820.
2015-05-17 09:36:23 +02:00
Claude Paroz ae635cc365 Fixed #24757 -- Recreated MySQL index when needed during combined index removal
Thanks Thomas Recouvreux for the report and Tim Graham for the tests and
review.
2015-05-15 17:07:14 +02:00
Claude Paroz 02260ea3f6 Fixed #24595 -- Prevented loss of null info in MySQL field alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
2015-04-17 10:25:15 +02:00
Jon Dufresne 2cf58e80d1 Fixed #24584 -- Fixed microsecond handling with older MySQLdb 2015-04-06 22:43:51 +02:00
Andriy Sokolovskiy 29b4a3f513 Removed duplicate attribute in MySQL DatabaseSchemaEditor. 2015-03-30 19:23:41 -04:00
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Marc Tamlyn 32d4db66b9 Update converters to take a consistent set of parameters.
As suggested by Anssi. This has the slightly strange side effect of
passing the expression to Expression.convert_value has the expression
passed back to it, but it allows more complex patterns of expressions.
2015-02-20 11:35:52 +00:00
Adam Chainz e9282747a4 Removed unused foreign_key_re variables in MySQL/Oracle DB backends 2015-02-18 10:22:30 -05:00
я котик пур-пур 981bd64dfb Unified local imports in django.db.backends.mysql. 2015-02-09 08:23:17 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 75303b01a9 Fixed #24245 -- Added introspection for database defaults.
Needed for tests for migrations handling of database defaults.
2015-01-31 12:33:11 -05:00
Tim Graham 2b039d966f Removed obsolete SQL generation methods. 2015-01-18 15:58:06 -05:00
Tim Graham 28308078f3 Fixed #22603 -- Reorganized classes in django.db.backends. 2015-01-14 14:16:20 -05:00
Josh Smeaton 21b858cb67 Fixed #24060 -- Added OrderBy Expressions 2015-01-13 09:39:55 +11:00
Claude Paroz 4c413e231c Fixed #17785 -- Preferred column names in get_relations introspection
Thanks Thomas Güttler for the report and the initial patch, and
Tim Graham for the review.
2015-01-12 19:58:47 +01:00
Claude Paroz 68a439a18d Removed supports_binary_field flag as all backends support them
It was mainly for MySQL on Python 3, but now the current
recommended MySQL driver for Python 3 (mysqlclient) does support
binary fields, it is unneeded. Refs #20377.
2015-01-11 23:34:47 +01:00
Anssi Kääriäinen 0c7633178f Fixed #24020 -- Refactored SQL compiler to use expressions
Refactored compiler SELECT, GROUP BY and ORDER BY generation.
While there, also refactored select_related() implementation
(get_cached_row() and get_klass_info() are now gone!).

Made get_db_converters() method work on expressions instead of
internal_type. This allows the backend converters to target
specific expressions if need be.

Added query.context, this can be used to set per-query state.

Also changed the signature of database converters. They now accept
context as an argument.
2015-01-08 14:07:54 -05:00
Tim Graham 93d73dac91 Moved DatabaseCreation.data_types properties to DatabaseWrapper.
refs #22340.
2014-12-31 08:29:17 -05:00
Tim Graham 8082c75d18 Removed db.backends methods which only call super(). 2014-12-30 11:53:59 -05:00
Claude Paroz 2ceb10f3b0 Fixed #14180 -- Prevented unneeded index creation on MySQL-InnoDB
Thanks zimnyx for the report and Simon Charette, Tim Graham for
the reviews.
2014-12-27 12:52:44 +01:00
Josh Smeaton 4718296546 Fixed #23753 -- Added a suite of SQL Functions
Added functions and tests
Added docs and more tests
Added TextField converter to mysql backend
Aliased Value as V in example docs and tests
Removed unicode_compatible in example
Fixed console emulation in examples
2014-12-27 15:27:27 +11:00
Marc Tamlyn 57554442fe Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
2014-12-20 18:28:29 +00:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Thomas Chaumeny 6b5d82749c Fixed #16731 -- Made pattern lookups work properly with F() expressions 2014-11-28 12:50:42 +02:00
Anssi Kääriäinen cbb5cdd155 Fixed #23867 -- removed DateQuerySet hacks
The .dates() queries were implemented by using custom Query, QuerySet,
and Compiler classes. Instead implement them by using expressions and
database converters APIs.
2014-11-26 17:49:25 -05:00
Collin Anderson d4ea4eea79 Fixed #23889 -- Added more usage of quote_name_unless_alias() to avoid deprecation warnings. 2014-11-21 16:44:50 -05:00
Claude Paroz 11662022be Added AutoField introspection for MySQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Tim Graham 5bcd292098 Fixed #23871 -- Removed promotion of MySQL warnings to errors in DEBUG mode. 2014-11-19 16:07:49 -05:00
Thomas Chaumeny 88b2a20f04 Simplified MySQL storage engine detection using INFORMATION_SCHEMA.ENGINES table
Query the table introduced in MySQL 5.1; refs #23144.
2014-11-10 18:16:14 +01:00
Claude Paroz 713f23492a Required MySQLdb >= 1.2.5 for fractional seconds support
On MySQLdb < 1.2.5, MySQLdb returns None when fetching datetime/time
values with fractional seconds.
See https://github.com/farcepest/MySQLdb1/issues/24
2014-10-28 15:06:58 +01:00
Claude Paroz 22da5f8817 Fixed #19716 -- Added support for microseconds with MySQL 5.6.4 and up
Thanks erik@cederstrand.dk for the report and Tim Graham for the review.
2014-10-28 15:06:58 +01:00
Claude Paroz 9e746c13e8 Stopped stripping microseconds with MySQL backend
Refs #19716.
2014-10-28 15:06:57 +01:00
Claude Paroz 5b8e37a69e Fixed typo in MySQL backend doctring
Thanks CHI Cheng for the report.
2014-10-27 14:01:12 +01:00
Claude Paroz 7f089ac2e3 Fixed #23446 -- Officially recommended mysqlclient as MySQL driver
Thanks Corey Farwell for the report and Tim Graham for the review.
Thanks also to Inada Naoki for creating and maintaining mysqlclient.
2014-10-27 09:11:33 +01:00
Shai Berger a54adcecff Fixed git blunder, refs #22738 2014-09-27 09:57:09 +03:00
Shai Berger c1ae0621ba Fixed #22738 -- made finer distinctions for when Boolean is not detected on Oracle
Thanks Claude Paroz for partial fix and Simon Charrette for review
2014-09-27 09:49:50 +03:00
Claude Paroz dbdae3a755 Fixed #22738 -- Abstracted boolean field type introspection
Thanks maxi for the report, Shai Berger for his help with the patch
and Tim Graham for the review.
2014-09-26 20:03:44 +02:00
Claude Paroz d1ca70110f Factorized schema_editor() at BaseDatabaseWrapper level 2014-09-26 08:50:16 +02:00
Tim Graham 74e7f91e6d Fixed #23538 -- Added SchemaEditor for MySQL GIS.
Thanks Claude Paroz for suggestions and review.
2014-09-25 13:53:44 -04:00
Claude Paroz b8cdc7dcc3 Made get_table_list return a TableInfo named tuple 2014-09-23 20:13:31 +02:00
Marc Tamlyn ed7821231b Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
2014-09-16 10:08:09 +01:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Marc Tamlyn e9103402c0 Fixed #18757, #14462, #21565 -- Reworked database-python type conversions
Complete rework of translating data values from database

Deprecation of SubfieldBase, removal of resolve_columns and
convert_values in favour of a more general converter based approach and
public API Field.from_db_value(). Now works seamlessly with aggregation,
.values() and raw queries.

Thanks to akaariai in particular for extensive advice and inspiration,
also to shaib, manfre and timograham for their reviews.
2014-09-03 20:36:03 +01:00
Jon Dufresne f0d3dd4f04 Fixed #23357 -- Added small int introspection support to MySQL backend.
In the MySQL backend, updated the can_introspect_small_integer feature
flag to True. In data_types_reverse, map FIELD_TYPE.SHORT to a
SmallIntegerField. Added test to verify introspecting SmallIntegerFields
and fixed existing tests influenced by this change.
2014-08-27 10:58:44 -04:00
zsoldosp 01801edd37 Fixed #22646: Added support for the MySQL ssl-ca option to dbshell. 2014-08-13 18:29:42 -04:00
Mihail Milushev bf5382c6e5 Fixed #22234 -- Replaced OS-specific code with subprocess.call() in dbshell.
This fixes escaping of special characters on Windows.
2014-08-04 09:21:03 -04:00
Tim Graham d28396f526 Fixed #23144 -- Dropped support for MySQL 5.0, 5.1. 2014-08-02 10:28:40 -04:00
Aymeric Augustin 729e4ae4f0 Fixed #23074 -- Avoided leaking savepoints in atomic.
Thanks Chow Loong Jin for the report and the initial patch.
2014-07-28 14:30:41 +02:00
Anubhav Joshi 91f1b6dcdc Fixed #13711 -- Model check added to ensure that auto-generated column name is within limits of the database.
Thanks russellm for report and Tim Graham for review.
2014-06-17 16:16:02 -04:00
Tim Graham 82c935d44c Renamed DatabaseFeature.supports_check_constraints to supports_column_check_constraints.
Thanks maxi for the suggestion.
2014-06-16 19:25:13 -04:00
Loic Bistuer 27a3cfcd77 Fixed unused import. 2014-05-21 10:42:07 +07:00
Andrew Godwin 125b3d4407 Fixed #22649: Beefed up quote_value 2014-05-20 15:41:01 +01:00
Loic Bistuer 1d3d01b4f7 Fixed #22424 -- Fixed handling of default values for TextField/BinaryField on MySQL.
Thanks syphar for the review and suggestions.
2014-05-18 11:58:16 +07:00
Aymeric Augustin fb90b7cda2 Adjusted refactoring of vendor checks.
Thanks Shai for the thorough review.
2014-05-10 14:40:42 +02:00
Aymeric Augustin 99d9fa329a Added feature flags for introspection capabilities. 2014-05-08 22:11:20 +02:00
Aymeric Augustin c70a61eb49 Replaced vendor checks by three feature flags. 2014-05-08 22:11:15 +02:00
Aymeric Augustin 3becac8484 Fixed #22321 -- Wrapped exceptions in _set_autocommit.
Refs #21202.
2014-04-10 20:16:12 +02:00
Aymeric Augustin 5f2f47fdfc Fixed #21553 -- Ensured unusable database connections get closed. 2014-04-09 22:41:33 +02:00
Simon Charette 1506c71a95 Fixed #12030 -- Validate integer field range at the model level.
Thanks to @timgraham for the review.
2014-03-25 14:31:20 -04:00
Shai Berger 41afae4ce9 Reorganized the database test settings
Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.
2014-03-09 03:57:18 +02:00
Russell Keith-Magee f7587b20da Edited MySQL-specific check messages for grammar and consistency. 2014-03-03 14:31:55 +08:00
Andrew Godwin 42607a9e33 Fixed #21844: Move quote_parameter off of Operations and rename 2014-02-09 12:42:26 +00:00
Vajrasky Kok d3cf6cfacf Fixed #17713 -- Renamed BaseDatabaseFeatures.allows_primary_key_0 to allows_auto_pk_0.
MySQL does allow primary key with value 0. It only forbids autoincrement
primary key with value 0.

Thanks Claude Paroz for the report.
2014-02-06 05:16:40 -05:00
Michael Manfre e1d839237f Make mysql's CursorWrapper a contextmanager. 2014-02-02 22:43:53 +01:00
Michael Manfre 3ffeb93186 Ensure cursors are closed when no longer needed.
This commit touchs various parts of the code base and test framework. Any
found usage of opening a cursor for the sake of initializing a connection
has been replaced with 'ensure_connection()'.
2014-02-02 12:47:21 -05:00
Russell Keith-Magee 494b408041 Corrected problem with MySQL checks handler and related fields. 2014-01-21 18:37:49 +08:00
Russell Keith-Magee d818e0c9b2 Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.
2014-01-20 10:45:21 +08:00
Loic Bistuer a2814846ca Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
coagulant 3bc0d46a84 Fixed all E261 warnings 2013-11-02 18:20:39 -04:00
Florian Hahn 5240b83462 Fixed #17027 -- Added support for the power operator in F expressions.
Thanks dan at dlo.me for the initial patch.

- Added __pow__ and __rpow__ to ExpressionNode
- Added oracle and mysql specific power expressions
- Added used-defined power function for sqlite
2013-10-22 10:29:57 -04:00
Alex Gaynor 98788d3c3a Remove some unnecesary uses of bool 2013-10-17 05:27:34 -07:00
Tim Graham adedc31072 Fixed "redefinition of unused 'foo' from line X" pyflakes warnings. 2013-10-10 11:09:42 -04:00
Aymeric Augustin 728548e483 Fixed #21134 -- Prevented queries in broken transactions.
Squashed commit of the following:

commit 63ddb271a44df389b2c302e421fc17b7f0529755
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 29 22:51:00 2013 +0200

    Clarified interactions between atomic and exceptions.

commit 2899ec299228217c876ba3aa4024e523a41c8504
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:45:32 2013 +0200

    Fixed TransactionManagementError in tests.

    Previous commit introduced an additional check to prevent running
    queries in transactions that will be rolled back, which triggered a few
    failures in the tests. In practice using transaction.atomic instead of
    the low-level savepoint APIs was enough to fix the problems.

commit 4a639b059ea80aeb78f7f160a7d4b9f609b9c238
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Sep 24 22:24:17 2013 +0200

    Allowed nesting constraint_checks_disabled inside atomic.

    Since MySQL handles transactions loosely, this isn't a problem.

commit 2a4ab1cb6e83391ff7e25d08479e230ca564bfef
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Sep 21 18:43:12 2013 +0200

    Prevented running queries in transactions that will be rolled back.

    This avoids a counter-intuitive behavior in an edge case on databases
    with non-atomic transaction semantics.

    It prevents using savepoint_rollback() inside an atomic block without
    calling set_rollback(False) first, which is backwards-incompatible in
    tests.

    Refs #21134.

commit 8e3db393853c7ac64a445b66e57f3620a3fde7b0
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:14:17 2013 +0200

    Replaced manual savepoints by atomic blocks.

    This ensures the rollback flag is handled consistently in internal APIs.
2013-09-30 09:42:27 +02:00
Claude Paroz 4c5bc1ac30 Removed double import in mysql base.py 2013-09-24 10:25:39 +02:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Andrew Godwin efd1e6096e Adding 'sqlmigrate' command and quote_parameter to support it. 2013-09-06 15:28:12 -05:00
Aymeric Augustin 868b4c921c Used six.moves.zip_longest, new in six 1.4.0. 2013-09-02 12:11:16 +02:00
Aymeric Augustin 365c3e8b73 Replaced "not PY3" by "PY2", new in six 1.4.0. 2013-09-02 12:11:02 +02:00
Simon Charette 11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Tim Graham c7d0ff0cad Fixed #20989 -- Removed explicit list comprehension inside dict() and tuple()
Thanks jeroen.pulles at redslider.net for the suggestion and
helper script.
2013-08-29 12:11:03 -04:00
Andrew Godwin 7970d97a70 Docs tweaks (thanks timgraham) 2013-08-10 20:00:12 +01:00
Andrew Godwin f093646bfc Remove pointless comment. 2013-08-09 17:47:13 +01:00
Andrew Godwin 03ec3219a0 Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/mysql/introspection.py
	django/db/backends/oracle/creation.py
	django/db/backends/postgresql_psycopg2/creation.py
	django/db/models/base.py
	django/db/models/loading.py
2013-07-22 19:04:25 +01:00
Alex Gaynor 43073dbd76 fixed a mis-importt in mysql/base.py 2013-07-08 11:18:06 +10:00
Alex Gaynor 03d9566e0d A large number of stylistic cleanups across django/db/ 2013-07-08 10:39:54 +10:00
Andrew Godwin 3a6580e485 Make get_constraints return columns in order 2013-07-02 18:02:20 +01:00
Andrew Godwin b1e0ec06f0 Merge branch 'master' into schema-alteration 2013-07-02 10:49:53 +01:00
Claude Paroz 59b0c48ce2 Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
Thanks reames at asymmetricventures.com for the report.
2013-06-29 18:44:41 +02:00
Andrew Godwin 9daf81b94e Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/loading.py
2013-06-19 12:05:23 +01:00
Aymeric Augustin 13b7f299de Added a stealth option to flush to allow cascades.
This allows using flush on a subset of the tables without having to
manually cascade to all tables with foreign keys to the tables being
truncated, when they're known to be empty.

On databases where truncate is implemented with DELETE FROM, this
doesn't make a difference. The cascade is allowed, not mandatory.
2013-06-10 11:21:54 +02:00
Andrew Godwin 3c296382b8 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/fields/related.py
2013-06-07 11:15:34 +01:00
Anssi Kääriäinen 37ea9f9c03 Fixed #20507 -- SubqueryConstraint alias handling
MySQL should work now, too.
2013-05-27 15:05:03 +03:00
Andrew Godwin cb4b0de49e Merge branch 'master' into schema-alteration 2013-05-10 12:55:30 +01:00
Aymeric Augustin 86b4ac665a [py3] Stopped iterating on exceptions. Refs #20025. 2013-05-08 13:05:23 +02:00
Aymeric Augustin e81e319f15 Fixed #20025 -- Pointed to a MySQLdb fork for Python 3.
Made a few minor compatibility adjustments.
2013-05-08 13:05:09 +02:00
Aymeric Augustin 1fff8daf88 Fixed test failures on MySQL.
Some tests failed when the time zone definitions were loaded in MySQL
and pytz wasn't installed. This setup isn't supported.
2013-05-08 13:03:36 +02:00
Andrew Godwin 7f3678dc4c Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/backends/mysql/base.py
	django/db/backends/oracle/base.py
	django/db/backends/oracle/creation.py
	django/db/backends/postgresql_psycopg2/base.py
	django/db/backends/sqlite3/base.py
	django/db/models/fields/related.py
2013-04-18 17:16:39 +01:00
Claude Paroz 8c41bd93c2 Fixed #16737 -- Support non-ascii column names in inspectdb
Thanks moof at metamoof.net for the report.
2013-04-01 19:59:57 +02:00
Claude Paroz 51028f50b6 Fixed getting max_digits for MySQL decimal fields
Refs #5014.
2013-04-01 18:17:00 +02:00
Claude Paroz 86b1c31689 Fixed #19954 -- Fixed MySQL _last_executed decoding
Queries can contain binary data undecodable with utf-8. In this
case, using the 'replace' errors mode when decoding seems like
an acceptable representation of the query.
Thanks Marcel Ryser for the report.
2013-03-28 20:08:37 +01:00
Anssi Kääriäinen 97774429ae Fixed #19385 again, now with real code changes
The commit of 266de5f9ae included only
tests, this time also code changes included...
2013-03-24 18:40:40 +02:00
Claude Paroz 76aecfbc4b Fixed #9055 -- Standardized behaviour of parameter escaping in db cursors
Previously, depending on the database backend or the cursor type,
you'd need to double the percent signs in the query before passing
it to cursor.execute. Now cursor.execute consistently need percent
doubling whenever params argument is not None (placeholder substitution
will happen).
Thanks Thomas Güttler for the report and Walter Doekes for his work
on the patch.
2013-03-23 17:11:10 +01:00
Aymeric Augustin 918f44e3ae Moved standard SQL for savepoints in the base backend.
These methods are only called when uses_savepoints = True anyway.
2013-03-11 14:48:54 +01:00
Aymeric Augustin f515619494 Added an API to control database-level autocommit. 2013-03-11 14:48:53 +01:00
Aymeric Augustin d63e55039d Reordered methods in database wrappers.
* Grouped related methods together -- with banner comments :/
* Described which methods are intended to be implemented in backends.
* Added docstrings.
* Used the same order in all wrappers.
2013-03-02 13:33:17 +01:00
Claude Paroz 8ee1eddb7e Add a BinaryField model field
Thanks Michael Jung, Charl Botha and Florian Apolloner for review
and help on the patch.
2013-03-02 10:29:02 +01:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Aymeric Augustin 59a3520875 Refactored database exceptions wrapping.
Squashed commit of the following:

commit 2181d833ed1a2e422494738dcef311164c4e097e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 27 14:28:39 2013 +0100

    Fixed #15901 -- Wrapped all PEP-249 exceptions.

commit 5476a5d93c19aa2f928c497d39ce6e33f52694e2
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:26:52 2013 +0100

    Added PEP 3134 exception chaining.

    Thanks Jacob Kaplan-Moss for the suggestion.

commit 9365fad0a650328002fb424457d675a273c95802
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:13:49 2013 +0100

    Improved API for wrapping database errors.

    Thanks Alex Gaynor for the proposal.

commit 1b463b765f2826f73a8d9266795cd5da4f8d5e9e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 15:00:39 2013 +0100

    Removed redundant exception wrapping.

    This is now taken care of by the cursor wrapper.

commit 524bc7345a724bf526bdd2dd1bcf5ede67d6bb5c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:55:10 2013 +0100

    Wrapped database exceptions in the base backend.

    This covers the most common PEP-249 APIs:
    - Connection APIs: close(), commit(), rollback(), cursor()
    - Cursor APIs: callproc(), close(), execute(), executemany(),
      fetchone(), fetchmany(), fetchall(), nextset().

    Fixed #19920.

commit a66746bb5f0839f35543222787fce3b6a0d0a3ea
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:53:34 2013 +0100

    Added a wrap_database_exception context manager and decorator.

    It re-throws backend-specific exceptions using Django's common wrappers.
2013-02-27 17:26:54 +01:00
Tomasz Rybak d7429defe6 Add sqldropindexes to manage
Change patch from https://code.djangoproject.com/ticket/5568
to work on modern Django.
Add special case for MySQL which has different syntax for DROP INDEX.
Add unit tests for the new functionality.
2013-02-24 12:38:28 +01:00
Alex Gaynor fd3a066ae3 This function is unused and should have been removed a few releases ago. 2013-02-19 18:05:02 -08:00
Aymeric Augustin ebabd77291 Ensured a connection is established when checking the database version.
Fixed a test broken by 21765c0a. Refs #18135.
2013-02-19 10:51:24 +01:00
Aymeric Augustin 7b8529d206 Removed duplicate caching of mysql_version.
The manual caching in self.server_version and the cached_property
decorator are redundant.
2013-02-18 22:13:05 +01:00
Aymeric Augustin 282b2f40cd Fixed #15119 -- Stopped pinging the MySQL server. 2013-02-18 22:12:19 +01:00
Aymeric Augustin aea98e8c53 Simplified MySQL version checking.
Django used to check the version of MySQL before handling the first
request, which required:
- opening a connection
- closing it, to avoid holding it idle until the first request.

This code isn't necessary any longer since Django dropped support for
some versions of MySQL, and other database backends don't implement a
similar dance. For consistency and maintenability, remove it.

Reverts 4423757c0c.

Closes #18135.
2013-02-18 21:46:26 +01:00
Aymeric Augustin 29628e0b6e Factored out common code in database backends. 2013-02-18 17:19:09 +01:00
Aymeric Augustin e74e207cce Fixed #17260 -- Added time zone aware aggregation and lookups.
Thanks Carl Meyer for the review.

Squashed commit of the following:

commit 4f290bdb60
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 21:21:30 2013 +0100

    Used '0:00' instead of 'UTC' which doesn't always exist in Oracle.

    Thanks Ian Kelly for the suggestion.

commit 01b6366f3c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 13:38:43 2013 +0100

    Made tzname a parameter of datetime_extract/trunc_sql.

    This is required to work around a bug in Oracle.

commit 924a144ef8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 14:47:44 2013 +0100

    Added support for parameters in SELECT clauses.

commit b4351d2890
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 22:30:22 2013 +0100

    Documented backwards incompatibilities in the two previous commits.

commit 91ef84713c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:42:31 2013 +0100

    Used QuerySet.datetimes for the admin's date_hierarchy.

commit 0d0de288a5
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:29:38 2013 +0100

    Used QuerySet.datetimes in date-based generic views.

commit 9c0859ff7c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:25 2013 +0100

    Implemented QuerySet.datetimes on Oracle.

commit 68ab511a4f
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:14 2013 +0100

    Implemented QuerySet.datetimes on MySQL.

commit 22d52681d3
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:42:29 2013 +0100

    Implemented QuerySet.datetimes on SQLite.

commit f6800fd04c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:03 2013 +0100

    Implemented QuerySet.datetimes on PostgreSQL.

commit 0c829c23f4
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:41:08 2013 +0100

    Added datetime-handling infrastructure in the ORM layers.

commit 104d82a777
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 10:05:55 2013 +0100

    Updated null_queries tests to avoid clashing with the __second lookup.

commit c01bbb3235
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 23:07:41 2013 +0100

    Updated tests of .dates().

    Replaced .dates() by .datetimes() for DateTimeFields.
    Replaced dates with datetimes in the expected output for DateFields.

commit 50fb7a5246
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:40:09 2013 +0100

    Updated and added tests for QuerySet.datetimes.

commit a8451a5004
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 22:34:46 2013 +0100

    Documented the new time lookups and updated the date lookups.

commit 29413eab2b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 16:15:49 2013 +0100

    Documented QuerySet.datetimes and updated QuerySet.dates.
2013-02-16 09:19:04 +01:00
Claude Paroz 3c0a81aaf0 Fixed #19709 -- Fixed TimeField introspection on MySQL
Thanks Eugene Grachev for the report.
2013-01-31 20:41:57 +01:00
Aymeric Augustin f46d7314b5 Fixed #19677 -- Introspection of recursive foreign keys under SQLite.
Thanks Simon Charette.
2013-01-28 10:17:56 +01:00
Claude Paroz 223fc8eaf9 Return namedtuple from get_table_description
We don't make use of it currently to not break third-party db
backends.
2013-01-12 21:14:22 +01:00
Andrew Godwin b62e82365a Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/loading.py
	django/db/models/options.py
2012-12-18 09:02:07 +00:00
Anssi Kääriäinen 1893467784 Fixed #19274 -- Made db connection creation overridable in subclasses
Connection creation was done in db backend ._cursor() call. This
included taking a new connection if needed, initializing the session
state for the new connection and finally creating the connection.

To allow easier modifying of these steps in subclasses (for example to
support connection pools) the _cursor() now calls get_new_connection()
and init_connection_state() if there isn't an existing connection. This
was done for all non-gis core backends. In addition the parameters used
for taking a connection are now created by get_connection_params().

We should also do the same for gis backends and encourage 3rd party
backends to use the same pattern. The pattern is not enforced in code,
and as the backends are private API this will not be required by
documentation either.
2012-11-27 19:47:19 +02:00
Andrew Godwin 6a632e0457 Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/models/fields/related.py
	django/db/models/options.py
2012-10-26 08:41:13 +01:00
Aymeric Augustin c736a1a9f8 Fixed #19176 -- Typo in copy-pasted error message.
Thanks maxirobaina for the report.
2012-10-24 16:21:30 +02:00
Andrew Godwin 588b839b26 Fix NOT NULL sql for MySQL 2012-09-24 12:52:43 +01:00
Andrew Godwin c5e2ecae69 Fix bug in get_indexes affecting the tests 2012-09-17 23:45:00 +01:00