Python sqlalchemy.util 模块,text_type() 实例源码
我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用sqlalchemy.util.text_type()。
def _execute_scalar(self, stmt):
return super(OracleExecutionContext_cx_oracle_with_unicode, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5,):
# no output type handlers before version 5
return
cx_Oracle = self.dbapi
def output_type_handler(cursor, name, defaultType,
size, precision, scale):
# convert all NUMBER with precision + positive scale to Decimal
# this almost allows "native decimal" mode.
if self.supports_native_decimal and \
defaultType == cx_Oracle.NUMBER and \
precision and scale > 0:
return cursor.var(
cx_Oracle.STRING,
255,
outconverter=self._to_decimal,
arraysize=cursor.arraysize)
# if NUMBER with zero precision and 0 or neg scale,this appears
# to indicate "ambiguous". Use a slower converter that will
# make a decision based on each value received - the type
# may change from row to row (!). This kills
# off "native decimal" mode,handlers still needed.
elif self.supports_native_decimal and \
defaultType == cx_Oracle.NUMBER \
and not precision and scale <= 0:
return cursor.var(
cx_Oracle.STRING,
outconverter=self._detect_decimal,
arraysize=cursor.arraysize)
# allow all strings to come back natively as Unicode
elif self.coerce_to_unicode and \
defaultType in (cx_Oracle.STRING, cx_Oracle.FIXED_CHAR):
return cursor.var(util.text_type, size, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, stmt, type_):
return super(OracleExecutionContext_cx_oracle_with_unicode, self).\
_execute_scalar(util.text_type(stmt), type_)
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
def _execute_scalar(self, self).\
_execute_scalar(util.text_type(stmt))
def on_connect(self):
if self.cx_oracle_ver < (5, cursor.arraysize)
def on_connect(conn):
conn.outputtypehandler = output_type_handler
return on_connect
def assert_raises_message(except_cls, e)
print(util.text_type(e).encode('utf-8'))
def __init__(self, **kw)
self.statement = util.text_type(self.statement)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。