--- /dev/null
+.. change::
+ :tags: bug, oracle
+ :tickets: 4886
+
+ Restored adding cx_Oracle.DATETIME to the setinputsizes() call when a
+ SQLAlchemy :class:`.Date`, :class:`.DateTime` or :class:`.Time` datatype is
+ used, as some complex queries require this to be present. This was removed
+ in the 1.2 series for arbitrary reasons.
"""
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."""
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
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",)