diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2019-10-03 21:41:40 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-10-03 21:41:40 +0000 |
| commit | 9b04f7cfe2f1a966fc2cf531f9f50453927b855d (patch) | |
| tree | 67b840e71343d51b19ec048b5745e9792801c2c9 /lib/sqlalchemy/testing | |
| parent | 8a0125c1ecb6db8c059a48affe78579d040e48af (diff) | |
| parent | e21afbcd8c78e4e3f9400da1a2565472682de825 (diff) | |
| download | sqlalchemy-9b04f7cfe2f1a966fc2cf531f9f50453927b855d.tar.gz | |
Merge "call setinputsizes for cx_Oracle.DATETIME"
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 29 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index ca7a42db4..62e442b6b 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -193,6 +193,14 @@ class SuiteRequirements(Requirements): return exclusions.closed() @property + def standalone_null_binds_whereclause(self): + """target database/driver supports bound parameters with NULL in the + WHERE clause, in situations where it has to be typed. + + """ + return exclusions.open() + + @property def intersect(self): """Target database must support INTERSECT or equivalent.""" return exclusions.closed() diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index 37428c545..435ab4689 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -14,7 +14,9 @@ from ..schema import Column from ..schema import Table from ... import and_ from ... import BigInteger +from ... import bindparam from ... import Boolean +from ... import case from ... import cast from ... import Date from ... import DateTime @@ -291,6 +293,33 @@ class _DateFixture(_LiteralRoundTripFixture): compare = self.compare or self.data self._literal_round_trip(self.datatype, [self.data], [compare]) + @testing.requires.standalone_null_binds_whereclause + def test_null_bound_comparison(self): + # this test is based on an Oracle issue observed in #4886. + # passing NULL for an expression that needs to be interpreted as + # a certain type, does the DBAPI have the info it needs to do this. + date_table = self.tables.date_table + with config.db.connect() as conn: + result = conn.execute( + date_table.insert(), {"date_data": self.data} + ) + id_ = result.inserted_primary_key[0] + stmt = select([date_table.c.id]).where( + case( + [ + ( + bindparam("foo", type_=self.datatype) != None, + bindparam("foo", type_=self.datatype), + ) + ], + else_=date_table.c.date_data, + ) + == date_table.c.date_data + ) + + row = conn.execute(stmt, {"foo": None}).first() + eq_(row[0], id_) + class DateTimeTest(_DateFixture, fixtures.TablesTest): __requires__ = ("datetime",) |
