Add VARBINARY to CursorWrapper (#395)
This commit is contained in:
Родитель
970a66fae3
Коммит
ebd32e16df
|
@ -597,6 +597,8 @@ class CursorWrapper(object):
|
|||
return 'TIME'
|
||||
elif isinstance(value, UUID):
|
||||
return 'uniqueidentifier'
|
||||
elif isinstance(value, bytes):
|
||||
return 'VARBINARY'
|
||||
else:
|
||||
raise NotImplementedError('Not supported type %s (%s)' % (type(value), repr(value)))
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import django.db.utils
|
||||
from django.db import connections
|
||||
from django.test import TransactionTestCase
|
||||
from django.db import connections, connection
|
||||
from django.test import TransactionTestCase, TestCase
|
||||
|
||||
from ..models import Author
|
||||
from ..models import Author, BinaryData
|
||||
|
||||
class TestTableWithTrigger(TransactionTestCase):
|
||||
def test_insert_into_table_with_trigger(self):
|
||||
|
@ -27,4 +27,9 @@ class TestTableWithTrigger(TransactionTestCase):
|
|||
finally:
|
||||
with connection.schema_editor() as cursor:
|
||||
cursor.execute("DROP TRIGGER TestTrigger")
|
||||
connection.features_class.can_return_rows_from_bulk_insert = old_return_rows_flag
|
||||
connection.features_class.can_return_rows_from_bulk_insert = old_return_rows_flag
|
||||
|
||||
class TestBinaryfieldGroupby(TestCase):
|
||||
def test_varbinary(self):
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(f"SELECT binary FROM {BinaryData._meta.db_table} WHERE binary = %s GROUP BY binary", [bytes("ABC", 'utf-8')])
|
||||
|
|
Загрузка…
Ссылка в новой задаче