Commit Graph

263 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss bb2aa792af Fixed #10063: stop passing the -W flag to psql since it isn't needed and interferes with .pgpass. Thanks, Walter.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10360 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 02:03:46 +00:00
Justin Bronn d02ee6bd7b Fixed redundant definition of `connection_created` signal due to DVCS mistake. My bad.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 03:11:12 +00:00
Justin Bronn da3b38cdda Fixed #6064 -- Added the `connection_created` signal for when a database connection is created.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10182 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-29 23:15:58 +00:00
Ian Kelly faf1609851 Fixed an issue with unicode being mangled in Oracle when the database character set is non-unicode.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-27 19:48:02 +00:00
Justin Bronn 6e3b129f15 Fixed #9628 -- Use `pysqlite2` for database backend, if installed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 03:57:21 +00:00
Malcolm Tredinnick 536ccd1134 More fixing of PostgreSQL < 8.2 problems with the psycopg2 backend.
Affects the postgresql_psycopg2 backend only. We now don't use the
"RETURNING" syntax in SQL INSERT statements unless it's required by the
autocommit behaviour. This fixes an edge-case that could cause crashes
with earlier PostgreSQL versions, but the broader problem remains to be
fixed (which is #10509).

Fixed #10467. Refs #10509.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10065 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-16 00:34:58 +00:00
Ian Kelly 83c1572cc4 Fixed #10488: fixed DB cache backend test failures in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10051 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 21:04:48 +00:00
Ian Kelly 0ae95f80b4 Fixed #10238: coerce TextField values to unicode in the oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 19:57:00 +00:00
Ian Kelly c3dc837950 Fixed #10473: Added Oracle support for "RETURNING" ids from insert statements.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 23:41:27 +00:00
Malcolm Tredinnick 5eccc59652 Tweaked the dummy database backend initialisation.
In order to report more comphrehensible tracebacks, remove the super()
constructor call, since passing args to object.__init__ ends badly. So some
subclassing possibilities are now removed, but it's the "dummy" backend, so
we can make some compromises.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10042 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 08:52:42 +00:00
Malcolm Tredinnick a152909069 Fixed #10467 -- Fixed generated INSERT SQL for PostgreSQL 8.1 and earlier.
I introduced a bad regression in r10029, forgetting to check that some
syntax was supported. For now, you can't use autocommit=True with 8.1
and earlier (it's still available for later versions). I'll fix the
broader issue later and re-enable it for those versions, but I want to
get the SQL regression for the default path out of the code right now.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:32:00 +00:00
Malcolm Tredinnick d4677d4bfb Slight refactoring of isolation setting from r10029.
There was a bug in the way we were reading the DATABASE_OPTIONS setting
and a lot of essentially duplicated code. This is neater.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:30:51 +00:00
Ian Kelly 90a3c34b35 Fixed some breakages in the Oracle test database handling from r10026.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 21:14:18 +00:00
Russell Keith-Magee 1d8e6eae34 Fixed #10463 -- Corrected a problem with the MySQL backend, introduced by [10026].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 11:03:36 +00:00
Malcolm Tredinnick 5fb6667036 Fixed #3460 -- Added an ability to enable true autocommit for psycopg2 backend.
Ensure to read the documentation before blindly enabling this: requires some
code audits first, but might well be worth it for busy sites.

Thanks to nicferrier, iamseb and Richard Davies for help with this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 07:06:50 +00:00
Malcolm Tredinnick 0543f33bbc Fixed the django.contrib.gis test database creation as well.
Refs r10026 and r10027.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10028 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 05:48:26 +00:00
Malcolm Tredinnick 6c6edb9d04 Fixed some breakages in the test database handling from r10026.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 04:56:13 +00:00
Adrian Holovaty 315145f7ca Fixed #10459 -- Refactored the internals of database connection objects so that connections know their own settings and pass around settings as dictionaries instead of passing around the Django settings module itself. This will make it easier for multiple database support. Thanks to Alex Gaynor for the initial patch.
This is backwards-compatible but will likely break third-party database backends. Specific API changes are:

* BaseDatabaseWrapper.__init__() now takes a settings_dict instead of a settings module. It's called settings_dict to disambiguate, and for easy grepability. This should be a dictionary containing DATABASE_NAME, etc.

* BaseDatabaseWrapper has a settings_dict attribute instead of an options attribute. BaseDatabaseWrapper.options is now BaseDatabaseWrapper['DATABASE_OPTIONS']

* BaseDatabaseWrapper._cursor() no longer takes a settings argument.

* BaseDatabaseClient.__init__() now takes a connection argument (a DatabaseWrapper instance) instead of no arguments.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10026 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 03:39:34 +00:00
Ian Kelly a4f1e48ddb Added savepoint support to the Oracle backend, necessary per the thread at http://groups.google.com/group/django-developers/browse_thread/thread/c87cf2d97478c068/
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 18:37:22 +00:00
Malcolm Tredinnick 326c5813b9 Removed a FIXME from the queryset-refactor days.
Turns out, nothing needed to be fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 11:21:46 +00:00
Malcolm Tredinnick b4dd4d4bb7 Fixed #3163 -- Add a "Meta.managed" option to models.
This allows a model to be defined which is not subject to database table
creation and removal. Useful for models that sit over existing tables or
database views.

Thanks to Alexander Myodov, Wolfgang Kriesing and Ryan Kelly for the bulk of
this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 03:35:02 +00:00
Malcolm Tredinnick b5d4a8ae1b Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.
Thanks to rcoup for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:36:56 +00:00
Malcolm Tredinnick b740706707 Changed the way cache specifiers are parsed.
Allows us to reuse the same code in multiple places, avoiding new and
interesting bugs (the testing framework had a DIY version that was slightly
wrong, for example). Fixed #9833.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9936 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 08:13:38 +00:00
Malcolm Tredinnick 70911bf98d Fixed #8737 -- Made the PostgreSQL version number detection more flexible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 07:18:57 +00:00
Russell Keith-Magee 7d03ca9e86 Fixed #10161 -- Modified evaluation of query expressions to allow for operators that take the form of functions. This is mostly for the benefit of Oracle, but it should prove useful later on. Thanks to Ian for the report and feedback on the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-24 11:15:31 +00:00
Russell Keith-Magee fc02370cee Fixed #10289 -- Corrected typo that produced oversensitive rejection of Postgres versions. Thanks to Ian Kelly for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-17 23:33:30 +00:00
Ian Kelly e9af96de1e Fixed #10224: Don't attempt to decode binary string data in the Oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-11 00:15:23 +00:00
Karen Tracey addd3df3bd Fixed #7672 -- Added a 'week_day' lookup type. Many thanks to Ross Poulton for the proposal and implementation on all built-in database backends..
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-08 05:08:06 +00:00
Ian Kelly e3d64c6fca Fixed #10125: fixed the Oracle dsn construction code that was broken in [9712].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9812 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-03 22:08:57 +00:00
Russell Keith-Magee 65ad2132ab Fixed #10142 -- Added docs and an exploding error message to highlight an error present in the implementation of STDDEV_POP and VAR_POP in PostgreSQL 8.2-8.2.4 that will give incorrect answers (the database function mistakenly returns sample, rather than population deviation/variance). Thanks to Vinay Sajip <vinay_sajip@yahoo.co.uk> for the report, and Ian Kelly for pointing out the cause of the problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9804 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-02 12:03:31 +00:00
Ian Kelly 728108883a Fixed #9275: Extended the Oracle date format to allow DATE columns to be used with DateTimeFields, especially when using legacy databases. Thanks to hollerith for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9779 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-19 20:49:12 +00:00
Matt Boersma b41a45f8e5 Fixed #5543: callproc() and friends now work with Oracle and our FormatStylePlaceholderCursor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 22:23:58 +00:00
Ian Kelly 1c1425130d Fixed #6767: corrected a 2.3 compatibility issue in [9750]. Thanks to tlow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9761 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 16:51:01 +00:00
Karen Tracey 344f16e220 Fixed #8138 -- Changed django.test.TestCase to rollback tests (when the database supports it) instead of flushing and reloading the database. This can substantially reduce the time it takes to run large test suites.
This change may be slightly backwards incompatible, if existing tests need to test transactional behavior, or if they rely on invalid assumptions or a specific test case ordering.  For the first case, django.test.TransactionTestCase should be used.  TransactionTestCase is also a quick fix to get around test case errors revealed by the new rollback approach, but a better long-term fix is to correct the test case.  See the testing doc for full details.

Many thanks to:
* Marc Remolt for the initial proposal and implementation.
* Luke Plant for initial testing and improving the implementation.
* Ramiro Morales for feedback and help with tracking down a mysterious PostgreSQL issue.
* Eric Holscher for feedback regarding the effect of the change on the Ellington testsuite.
* Russell Keith-Magee for guidance and feedback from beginning to end.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 02:30:22 +00:00
Ian Kelly acfe5cc880 Fixed #6767: changed the way the Oracle backend fetches numbers to prevent decimals being returned as floats.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 20:39:09 +00:00
Karen Tracey 91e25f9ef8 Fixed #10033: In the Oracle backend, restored code lost in the aggregation merge that ensured a datetime object is returned for fields known to be datetimes, even when the time part is all zero.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9747 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 15:11:28 +00:00
Russell Keith-Magee 3937de4e24 Removed an redundant import from the Oracle backend. Thanks to Ramiro Morales for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9745 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 12:44:45 +00:00
Russell Keith-Magee cc4e4d9aee Fixed #3566 -- Added support for aggregation to the ORM. See the documentation for details on usage.
Many thanks to:
 * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
 * Alex Gaynor for his help debugging and fixing a number of issues.
 * Justin Bronn for his help integrating with contrib.gis.
 * Karen Tracey for her help with cross-platform testing.
 * Ian Kelly for his help testing and fixing Oracle support.
 * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 11:06:34 +00:00
Ian Kelly c20019a91d Fixed #9972: The dbshell command was ignoring the DATABASE_HOST and DATABASE_PORT settings in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9713 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-08 05:12:14 +00:00
Malcolm Tredinnick 0c08368116 Fixed #9862 -- For better SQL portability, don't specify "NULL" on nullable
columns when creating tables. Patch from Ian Kelly.

Columns are NULL by default, so we only need to use "NOT NULL" when we want
non-default behaviour.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-06 01:56:13 +00:00
Malcolm Tredinnick dc4c95cdbf Fixed a typo in r9650.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-17 01:47:08 +00:00
Karen Tracey 5f78eff909 Fixed #9814 -- Allowed SafeStrings to be saved to sqlite DB when running on Python 2.6.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 14:28:22 +00:00
Malcolm Tredinnick b58a260c56 Fixed #9431 -- Added extra validation for VARCHAR-based fields on MySQL.
max_length > 255 and unique=True is not permitted. Based on a patch from
adamnelson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 06:43:18 +00:00
Matt Boersma 5257fd2225 Reformatted PL/SQL flush left so "manage.py sqlall [app] | manage.py dbshell" works with Oracle. Also some PEP8 cleanup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9644 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-11 20:12:00 +00:00
Malcolm Tredinnick a1cbeb9afb If an SQL query doesn't specify any ordering, avoid the implicit sort
that happens with MySQL when a "GROUP BY" clause is included. This is a
backend-specific operation, so any other databases requiring similar
encouragement can have a function added to their own backend code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-10 05:19:27 +00:00
Matt Boersma 15bd649940 Fixed obscure Oracle quoting issues pointed out by the custom_columns_regress test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9612 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 18:36:22 +00:00
Ian Kelly 4637a77ff8 Fixed #9706: made SlugField honor max_length in Oracle, matching the other backends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 18:40:40 +00:00
Ian Kelly 485316017a Fixed a pair of bugs in determining the set of models to flush that were causing test cause failures in Oracle after [9536].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9546 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 16:58:06 +00:00
Russell Keith-Magee 5834b1837f Fixed #9736 -- Added quoting to the SQL constraint names generated during table creation. This is to accommodate primary keys with spaces.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 13:23:29 +00:00
Malcolm Tredinnick 1418da7ee4 Fixed #6052 -- Worked around a bug in MySQLdb with regards to handling
SafeUnicode (handle SafeString similarly, just to be safe). Based on a patch
from sfllaw.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-16 08:50:06 +00:00