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
6bb6df29
Kaydet (Commit)
6bb6df29
authored
May 16, 2014
tarafından
Shai Berger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix storing of binary fields and unicode textfields for Oracle/Python3
üst
2e364a0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
base.py
django/db/backends/oracle/base.py
+8
-2
tests.py
tests/model_regress/tests.py
+11
-0
No files found.
django/db/backends/oracle/base.py
Dosyayı görüntüle @
6bb6df29
...
...
@@ -748,6 +748,7 @@ class OracleParam(object):
param
=
timezone
.
make_aware
(
param
,
default_timezone
)
param
=
Oracle_datetime
.
from_datetime
(
param
.
astimezone
(
timezone
.
utc
))
string_size
=
0
# Oracle doesn't recognize True and False correctly in Python 3.
# The conversion done below works both in 2 and 3.
if
param
is
True
:
...
...
@@ -756,15 +757,20 @@ class OracleParam(object):
param
=
"0"
if
hasattr
(
param
,
'bind_parameter'
):
self
.
force_bytes
=
param
.
bind_parameter
(
cursor
)
elif
isinstance
(
param
,
six
.
memoryview
):
elif
isinstance
(
param
,
Database
.
Binary
):
self
.
force_bytes
=
param
else
:
# To transmit to the database, we need Unicode if supported
# To get size right, we must consider bytes.
self
.
force_bytes
=
convert_unicode
(
param
,
cursor
.
charset
,
strings_only
)
if
isinstance
(
self
.
force_bytes
,
six
.
string_types
):
# We could optimize by only converting up to 4000 bytes here
string_size
=
len
(
force_bytes
(
param
,
cursor
.
charset
,
strings_only
))
if
hasattr
(
param
,
'input_size'
):
# If parameter has `input_size` attribute, use that.
self
.
input_size
=
param
.
input_size
elif
isinstance
(
param
,
six
.
string_types
)
and
len
(
param
)
>
4000
:
elif
string_size
>
4000
:
# Mark any string param greater than 4000 characters as a CLOB.
self
.
input_size
=
Database
.
CLOB
else
:
...
...
tests/model_regress/tests.py
Dosyayı görüntüle @
6bb6df29
...
...
@@ -66,6 +66,17 @@ class ModelTests(TestCase):
a
=
Article
.
objects
.
get
(
pk
=
a
.
pk
)
self
.
assertEqual
(
len
(
a
.
article_text
),
5000
)
def
test_long_unicode_textfield
(
self
):
# TextFields can hold more than 4000 bytes also when they are
# less than 4000 characters
a
=
Article
.
objects
.
create
(
headline
=
"Really, really big"
,
pub_date
=
datetime
.
datetime
.
now
(),
article_text
=
'
\u05d0\u05d1\u05d2
'
*
1000
)
a
=
Article
.
objects
.
get
(
pk
=
a
.
pk
)
self
.
assertEqual
(
len
(
a
.
article_text
),
3000
)
def
test_date_lookup
(
self
):
# Regression test for #659
Party
.
objects
.
create
(
when
=
datetime
.
datetime
(
1999
,
12
,
31
))
...
...
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