summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-05-09 20:19:34 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-05-09 20:19:34 +0000
commit5311a8531c621760ced0b3d0a5454e8c22871d66 (patch)
tree9acf3d7b65fc45e5b64b7d806a8337f4d2d8ae0c /lib
parent7f084b7bd4db6bf91cde7f58fbcc55c6ef14f7af (diff)
parentfb28e40b31797dc9ad72f11a8edd4f2eb555a36d (diff)
downloadsqlalchemy-5311a8531c621760ced0b3d0a5454e8c22871d66.tar.gz
Merge "Use cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB"
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/dialects/oracle/cx_oracle.py12
-rw-r--r--lib/sqlalchemy/testing/suite/test_types.py23
2 files changed, 27 insertions, 8 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
index 4ff0f65ed..c61a1cc0a 100644
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
@@ -1003,17 +1003,16 @@ class OracleDialect_cx_oracle(OracleDialect):
dialect.encoding, errors=dialect.encoding_errors
)
return cursor.var(
- default_type,
+ cx_Oracle.LONG_STRING,
size,
cursor.arraysize,
- outconverter=lambda value: outconverter(value.read()),
+ outconverter=outconverter,
)
else:
return cursor.var(
- default_type,
+ cx_Oracle.LONG_STRING,
size,
cursor.arraysize,
- outconverter=lambda value: value.read(),
**dialect._cursor_var_unicode_kwargs
)
@@ -1021,10 +1020,7 @@ class OracleDialect_cx_oracle(OracleDialect):
cx_Oracle.BLOB,
):
return cursor.var(
- default_type,
- size,
- cursor.arraysize,
- outconverter=lambda value: value.read(),
+ cx_Oracle.LONG_BINARY, size, cursor.arraysize,
)
return output_type_handler
diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py
index 7719a3b3c..00b5fab27 100644
--- a/lib/sqlalchemy/testing/suite/test_types.py
+++ b/lib/sqlalchemy/testing/suite/test_types.py
@@ -136,6 +136,15 @@ class _UnicodeFixture(_LiteralRoundTripFixture, fixtures.TestBase):
for row in rows:
assert isinstance(row[0], util.text_type)
+ def _test_null_strings(self, connection):
+ unicode_table = self.tables.unicode_table
+
+ connection.execute(unicode_table.insert(), {"unicode_data": None})
+ row = connection.execute(
+ select([unicode_table.c.unicode_data])
+ ).first()
+ eq_(row, (None,))
+
def _test_empty_strings(self, connection):
unicode_table = self.tables.unicode_table
@@ -164,6 +173,9 @@ class UnicodeVarcharTest(_UnicodeFixture, fixtures.TablesTest):
def test_empty_strings_varchar(self, connection):
self._test_empty_strings(connection)
+ def test_null_strings_varchar(self, connection):
+ self._test_null_strings(connection)
+
class UnicodeTextTest(_UnicodeFixture, fixtures.TablesTest):
__requires__ = "unicode_data", "text_type"
@@ -175,6 +187,9 @@ class UnicodeTextTest(_UnicodeFixture, fixtures.TablesTest):
def test_empty_strings_text(self, connection):
self._test_empty_strings(connection)
+ def test_null_strings_text(self, connection):
+ self._test_null_strings(connection)
+
class TextTest(_LiteralRoundTripFixture, fixtures.TablesTest):
__requires__ = ("text_type",)
@@ -202,6 +217,7 @@ class TextTest(_LiteralRoundTripFixture, fixtures.TablesTest):
row = connection.execute(select([text_table.c.text_data])).first()
eq_(row, ("some text",))
+ @testing.requires.empty_strings_text
def test_text_empty_strings(self, connection):
text_table = self.tables.text_table
@@ -209,6 +225,13 @@ class TextTest(_LiteralRoundTripFixture, fixtures.TablesTest):
row = connection.execute(select([text_table.c.text_data])).first()
eq_(row, ("",))
+ def test_text_null_strings(self, connection):
+ text_table = self.tables.text_table
+
+ connection.execute(text_table.insert(), {"text_data": None})
+ row = connection.execute(select([text_table.c.text_data])).first()
+ eq_(row, (None,))
+
def test_literal(self):
self._literal_round_trip(Text, ["some text"], ["some text"])