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
59b0c48c
Kaydet (Commit)
59b0c48c
authored
Haz 29, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
Thanks reames at asymmetricventures.com for the report.
üst
7fbab3eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
base.py
django/db/backends/mysql/base.py
+1
-1
tests.py
tests/backends/tests.py
+11
-0
No files found.
django/db/backends/mysql/base.py
Dosyayı görüntüle @
59b0c48c
...
...
@@ -284,7 +284,7 @@ class DatabaseOperations(BaseDatabaseOperations):
# With MySQLdb, cursor objects have an (undocumented) "_last_executed"
# attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution.
return
force_text
(
cursor
.
_last_executed
,
errors
=
'replace'
)
return
force_text
(
getattr
(
cursor
,
'_last_executed'
,
None
)
,
errors
=
'replace'
)
def
no_limit_value
(
self
):
# 2**64 - 1, as recommended by the MySQL documentation
...
...
tests/backends/tests.py
Dosyayı görüntüle @
59b0c48c
...
...
@@ -164,6 +164,17 @@ class DateQuotingTest(TestCase):
@override_settings
(
DEBUG
=
True
)
class
LastExecutedQueryTest
(
TestCase
):
def
test_last_executed_query
(
self
):
"""
last_executed_query should not raise an exception even if no previous
query has been run.
"""
cursor
=
connection
.
cursor
()
try
:
connection
.
ops
.
last_executed_query
(
cursor
,
''
,
())
except
Exception
:
self
.
fail
(
"'last_executed_query' should not raise an exception."
)
def
test_debug_sql
(
self
):
list
(
models
.
Reporter
.
objects
.
filter
(
first_name
=
"test"
))
sql
=
connection
.
queries
[
-
1
][
'sql'
]
.
lower
()
...
...
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