FIXED_CHAR dbapi type being bound to statements.
later of cx_oracle.
- an NCLOB type is added to the base types.
-
+
+ - usage of the CHAR type results in cx_oracle's
+ FIXED_CHAR dbapi type being bound to statements.
+
- the Oracle dialect now features NUMBER which intends
to act justlike Oracle's NUMBER type. It is the primary
numeric type returned by table reflection and attempts
else:
return value
return process
+
+class _OracleChar(sqltypes.CHAR):
+ def get_dbapi_type(self, dbapi):
+ return dbapi.FIXED_CHAR
class _OracleText(_LOBMixin, sqltypes.Text):
def get_dbapi_type(self, dbapi):
sqltypes.Text : _OracleText,
sqltypes.UnicodeText : _OracleUnicodeText,
sqltypes.TIMESTAMP : _OracleTimestamp,
+ sqltypes.CHAR : _OracleChar,
sqltypes.Integer : _OracleInteger, # this is only needed for OUT parameters.
# it would be nice if we could not use it otherwise.
oracle.NUMBER : oracle.NUMBER, # don't let this get converted
oracle.RAW: _OracleRaw,
+
}
class Oracle_cx_oracleCompiler(OracleCompiler):
b = bindparam("foo", u"hello world!")
assert b.type.dialect_impl(dialect).get_dbapi_type(dbapi) == 'STRING'
+
+ def test_fixed_char(self):
+ m = MetaData(testing.db)
+ t = Table('t1', m,
+ Column('id', Integer, primary_key=True),
+ Column('data', CHAR(30), nullable=False)
+ )
+
+ t.create()
+ try:
+ t.insert().execute(
+ dict(id=1, data="value 1"),
+ dict(id=2, data="value 2"),
+ dict(id=3, data="value 3")
+ )
+ eq_(t.select().where(t.c.data=='value 2').execute().fetchall(),
+ [(2, 'value 2 ')]
+ )
+
+ m2 = MetaData(testing.db)
+ t2 = Table('t1', m2, autoload=True)
+ assert type(t2.c.data.type) is CHAR
+ eq_(t2.select().where(t2.c.data=='value 2').execute().fetchall(),
+ [(2, 'value 2 ')]
+ )
+
+ finally:
+ t.drop()
+
def test_type_adapt(self):
dialect = cx_oracle.dialect()