django1/django/db/backends
Florian Apolloner bc7dd8490b Fixed #21171 -- Avoided starting a transaction when a single (or atomic queries) are executed.
Checked the following locations:

 * Model.save(): If there are parents involved, take the safe way and use
   transactions since this should be an all or nothing operation.

   If the model has no parents:

    * Signals are executed before and after the previous existing
      transaction -- they were never been part of the transaction.

    * if `force_insert` is set then only one query is executed -> atomic
      by definition and no transaction needed.

    * same applies to `force_update`.

    * If a primary key is set and no `force_*` is set Django will try an
      UPDATE and if that returns zero rows it tries an INSERT. The first
      case is completly save (single query). In the second case a
      transaction should not produce different results since the update
      query is basically a no-op then (might miss something though).

 * QuerySet.update(): no signals issued, single query -> no transaction
   needed.

 * Model/Collector.delete(): This one is fun due to the fact that is
   does many things at once.

   Most importantly though: It does send signals as part of the
   transaction, so for maximum backwards compatibility we need to be
   conservative.

   To ensure maximum compatibility the transaction here is removed only
   if the following holds true:

     * A single instance is being deleted.
     * There are no signal handlers attached to that instance.
     * There are no deletions/updates to cascade.
     * There are no parents which also need deletion.
2018-10-17 12:19:02 +02:00
..
base Added django.db.backends.utils.names_digest() to remove redundant code. 2018-10-02 10:41:43 -04:00
dummy Refs #27656 -- Updated django.db docstring verbs according to PEP 257. 2017-02-28 09:17:27 -05:00
mysql Fixed #29845 -- Fixed Cast crash on MySQL when casting to DecimalField. 2018-10-15 15:57:22 +02:00
oracle Fixed #21171 -- Avoided starting a transaction when a single (or atomic queries) are executed. 2018-10-17 12:19:02 +02:00
postgresql Refs #29722 -- Added introspection of materialized views for PostgreSQL. 2018-10-02 14:02:04 -04:00
postgresql_psycopg2 Removed postgresql_psycopg2.version 2017-08-21 09:13:07 +02:00
sqlite3 Fixed #29767 -- Made date-related casts work on SQLite 2018-10-01 13:27:30 +02:00
__init__.py Fixed #22603 -- Reorganized classes in django.db.backends. 2015-01-14 14:16:20 -05:00
ddl_references.py Fixed #28077 -- Added support for PostgreSQL opclasses in Index. 2018-06-29 17:00:28 -04:00
signals.py Fixed #13798 -- Added connection argument to the connection_created signal. Thanks to liangent for the report, and Alex Gaynor for the patch. 2010-08-30 13:21:18 +00:00
utils.py Added django.db.backends.utils.names_digest() to remove redundant code. 2018-10-02 10:41:43 -04:00