summaryrefslogtreecommitdiff
path: root/django/db
AgeCommit message (Collapse)Author
2013-03-24Fixed #15124 -- Changed the default for BooleanField.Aymeric Augustin
Thanks to the many contributors who updated and improved the patch over the life of this ticket.
2013-03-23Fixed #9055 -- Standardized behaviour of parameter escaping in db cursorsClaude Paroz
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-22Fixed #20094 - Be more careful when checking for IteratorMarc Tamlyn
Python 2.6 has some different behaviour when checking isinstance(foo, collections.Iterator).
2013-03-21Removed unused importAnssi Kääriäinen
2013-03-20Revert "Fixed 19895 -- Made second iteration over invalid queryset raise an ↵Claude Paroz
exception too" This reverts commit 2cd0edaa477b327024e4007c8eaf46646dcd0f21. This commit was the cause of a memory leak. See ticket for more details. Thanks Anssi Kääriäinen for identifying the source of the bug.
2013-03-18Fixed #19968 -- Dropped support for PostgreSQL < 8.4.Aymeric Augustin
2013-03-17Fixed #19635 -- Made fields pickleableAnssi Kääriäinen
2013-03-17Merge pull request #902 from evildmp/BLANK_CHOICE_NONEAymeric Augustin
Fixed #20043 -- Removed unused BLANK_CHOICE_NONE
2013-03-14Fixed #16649 -- Refactored save_base logicAnssi Kääriäinen
Model.save() will use UPDATE - if not updated - INSERT instead of SELECT - if found UPDATE else INSERT. This should save a query when updating, but will cost a little when inserting model with PK set. Also fixed #17341 -- made sure .save() commits transactions only after the whole model has been saved. This wasn't the case in model inheritance situations. The save_base implementation was refactored into multiple methods. A typical chain for inherited save is: save_base() _save_parents(self) for each parent: _save_parents(parent) _save_table(parent) _save_table(self)
2013-03-13removed unused BLANK_CHOICE_NONEDaniele Procida
2013-03-13Improved recovery when the connection is closed in an atomic block.Aymeric Augustin
2013-03-13Made atomic usable when autocommit is off.Aymeric Augustin
Thanks Anssi for haggling until I implemented this. This change alleviates the need for atomic_if_autocommit. When autocommit is disabled for a database, atomic will simply create and release savepoints, and not commit anything. This honors the contract of not doing any transaction management. This change also makes the hack to allow using atomic within the legacy transaction management redundant. None of the above will work with SQLite, because of a flaw in the design of the sqlite3 library. This is a known limitation that cannot be lifted without unacceptable side effects eg. triggering arbitrary commits.
2013-03-13Refactored qs.add_q() and utils/tree.pyAnssi Kääriäinen
The sql/query.py add_q method did a lot of where/having tree hacking to get complex queries to work correctly. The logic was refactored so that it should be simpler to understand. The new logic should also produce leaner WHERE conditions. The changes cascade somewhat, as some other parts of Django (like add_filter() and WhereNode) expect boolean trees in certain format or they fail to work. So to fix the add_q() one must fix utils/tree.py, some things in add_filter(), WhereNode and so on. This commit also fixed add_filter to see negate clauses up the path. A query like .exclude(Q(reversefk__in=a_list)) didn't work similarly to .filter(~Q(reversefk__in=a_list)). The reason for this is that only the immediate parent negate clauses were seen by add_filter, and thus a tree like AND: (NOT AND: (AND: condition)) will not be handled correctly, as there is one intermediary AND node in the tree. The example tree is generated by .exclude(~Q(reversefk__in=a_list)). Still, aggregation lost connectors in OR cases, and F() objects and aggregates in same filter clause caused GROUP BY problems on some databases. Fixed #17600, fixed #13198, fixed #17025, fixed #17000, fixed #11293.
2013-03-12Fixed #19964 -- Removed relabel_aliases from some structsAnssi Kääriäinen
Before there was need to have both .relabel_aliases() and .clone() for many structs. Now there is only relabeled_clone() for those structs where alias is the only mutable attribute.
2013-03-12Fixed #20028 -- Made atomic usable on callable instances.Aymeric Augustin
Thanks Anssi for the report.
2013-03-11Fixed #20010 -- Make sure `last_executed_query` contains it's associated ↵Simon Charette
parameters on Oracle. Also removed some unused imports.
2013-03-11Avoided closing the database connection within a transaction.Aymeric Augustin
Refs #9437.
2013-03-11Improved the API of set_autocommit.Aymeric Augustin
2013-03-11Used commit_on_success_unless_managed to make ORM operations atomic.Aymeric Augustin
2013-03-11Added a safety net for developers messing with autocommit.Aymeric Augustin
2013-03-11Added an option to disable the creation of savepoints in atomic.Aymeric Augustin
2013-03-11Re-ordered functions by deprecation status.Aymeric Augustin
2013-03-11Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.Aymeric Augustin
Replaced them with per-database options, for proper multi-db support. Also toned down the recommendation to tie transactions to HTTP requests. Thanks Jeremy for sharing his experience.
2013-03-11Implemented atomic_if_autocommit.Aymeric Augustin
It disables transaction management entirely when AUTOCOMMIT is False.
2013-03-11Made transaction management work even before the first SQL query.Aymeric Augustin
Thanks Florian again.
2013-03-11Added some assertions to enforce the atomicity of atomic.Aymeric Augustin
2013-03-11Implemented an 'atomic' decorator and context manager.Aymeric Augustin
Currently it only works in autocommit mode. Based on @xact by Christophe Pettus.
2013-03-11Added support for savepoints in SQLite.Aymeric Augustin
Technically speaking they aren't usable yet.
2013-03-11Refactored implementation of savepoints.Aymeric Augustin
Prepared for using savepoints within transactions in autocommit mode.
2013-03-11Moved standard SQL for savepoints in the base backend.Aymeric Augustin
These methods are only called when uses_savepoints = True anyway.
2013-03-11Deprecated transaction.is_managed().Aymeric Augustin
It's synchronized with the autocommit flag.
2013-03-11Deprecated transaction.commit/rollback_unless_managed.Aymeric Augustin
Since "unless managed" now means "if database-level autocommit", committing or rolling back doesn't have any effect. Restored transactional integrity in a few places that relied on automatically-started transactions with a transitory API.
2013-03-11Removed superfluous code now that connections use autocommit by default.Aymeric Augustin
2013-03-11Enabled database-level autocommit for all backends.Aymeric Augustin
This is mostly a documentation change. It has the same backwards-incompatibility consequences as those described for PostgreSQL in a previous commit.
2013-03-11Removed _enter/_leave_transaction_management.Aymeric Augustin
The goal is to make all databases share a common, autocommit-based, implementation.
2013-03-11Added BaseDatabaseWrapper.ensure_connection.Aymeric Augustin
This API is useful because autocommit cannot be managed without an open connection.
2013-03-11Expressed the dirty flag handling logic in terms of autocommit.Aymeric Augustin
2013-03-11Stopped flipping the uses_savepoints feature at runtime.Aymeric Augustin
2013-03-11Enabled autocommit for PostgreSQL.Aymeric Augustin
For users who didn't activate autocommit in their database options, this is backwards-incompatible in "non-managed" aka "auto" transaction state. This state now uses database-level autocommit instead of ORM-level autocommit. Also removed the uses_autocommit feature which lost its purpose.
2013-03-11Separated autocommit and isolation level handling for PostgreSQL.Aymeric Augustin
Autocommit cannot be manipulated independently from an open connection. This commit introduces a minor change in behavior: entering transaction management forces opening a databasse connection. This shouldn't be backwards incompatible in any practical use case.
2013-03-11Added an API to control database-level autocommit.Aymeric Augustin
2013-03-11Made transaction.managed a no-op and deprecated it.Aymeric Augustin
enter_transaction_management() was nearly always followed by managed(). In three places it wasn't, but they will all be refactored eventually. The "forced" keyword argument avoids introducing behavior changes until then. This is mostly backwards-compatible, except, of course, for managed itself. There's a minor difference in _enter_transaction_management: the top self.transaction_state now contains the new 'managed' state rather than the previous one. Django doesn't access self.transaction_state in _enter_transaction_management.
2013-03-09Fixed BinaryField support on Oracle.Florian Apolloner
2013-03-08Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that ↵Loic Bistuer
return a QuerySet.
2013-03-07Added a ManyToManyField(db_constraint=False) option, this allows not ↵Alex Gaynor
creating constraints on the intermediary models.
2013-03-07Added missing method in the dummy database backend.Aymeric Augustin
2013-03-06One more EMPTY_VALUES replacement following 22be90dd17Claude Paroz
Thanks Loic Bistuer for catching this omission. Refs #19989.
2013-03-06Fixed #19989 -- Suppressed UnicodeWarning during BinaryField validationClaude Paroz
Thanks Aymeric Augustin for the report and Simon Charette for the review.
2013-03-02Fixed #18130 -- Made the isolation level configurable on PostgreSQL.Aymeric Augustin
Thanks limscoder for the report and niwi for the draft patch.
2013-03-02Reordered methods in database wrappers.Aymeric Augustin
* 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.