Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
14aa563f
Kaydet (Commit)
14aa563f
authored
Mar 05, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed superfluous code now that connections use autocommit by default.
üst
5e27debc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
22 deletions
+1
-22
creation.py
django/db/backends/creation.py
+1
-14
creation.py
django/db/backends/postgresql_psycopg2/creation.py
+0
-8
No files found.
django/db/backends/creation.py
Dosyayı görüntüle @
14aa563f
...
...
@@ -383,10 +383,7 @@ class BaseDatabaseCreation(object):
qn
=
self
.
connection
.
ops
.
quote_name
# Create the test database and connect to it. We need to autocommit
# if the database supports it because PostgreSQL doesn't allow
# CREATE/DROP DATABASE statements within transactions.
self
.
_prepare_for_test_db_ddl
()
# Create the test database and connect to it.
cursor
=
self
.
connection
.
cursor
()
try
:
cursor
.
execute
(
...
...
@@ -454,7 +451,6 @@ class BaseDatabaseCreation(object):
# to do so, because it's not allowed to delete a database while being
# connected to it.
cursor
=
self
.
connection
.
cursor
()
self
.
_prepare_for_test_db_ddl
()
# Wait to avoid "database is being accessed by other users" errors.
time
.
sleep
(
1
)
cursor
.
execute
(
"DROP DATABASE
%
s"
...
...
@@ -472,15 +468,6 @@ class BaseDatabaseCreation(object):
"BaseDatabaseWrapper."
,
PendingDeprecationWarning
,
stacklevel
=
2
)
return
self
.
connection
.
set_autocommit
()
def
_prepare_for_test_db_ddl
(
self
):
"""
Internal implementation - Hook for tasks that should be performed
before the ``CREATE DATABASE``/``DROP DATABASE`` clauses used by
testing code to create/ destroy test databases. Needed e.g. in
PostgreSQL to rollback and close any active transaction.
"""
pass
def
sql_table_creation_suffix
(
self
):
"""
SQL to append to the end of the test table creation statements.
...
...
django/db/backends/postgresql_psycopg2/creation.py
Dosyayı görüntüle @
14aa563f
...
...
@@ -77,11 +77,3 @@ class DatabaseCreation(BaseDatabaseCreation):
output
.
append
(
get_index_sql
(
'
%
s_
%
s_like'
%
(
db_table
,
f
.
column
),
' text_pattern_ops'
))
return
output
def
_prepare_for_test_db_ddl
(
self
):
"""Rollback and close the active transaction."""
# Make sure there is an open connection.
self
.
connection
.
cursor
()
self
.
connection
.
connection
.
rollback
()
self
.
connection
.
connection
.
set_isolation_level
(
psycopg2
.
extensions
.
ISOLATION_LEVEL_AUTOCOMMIT
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment