_process_row = BufferedColumnRow
def _get_col(self, row, key):
- rec = self._key_cache[key]
- return row[rec[2]]
+ try:
+ rec = self._key_cache[key]
+ return row[rec[2]]
+ except TypeError:
+ # the 'slice' use case is very infrequent,
+ # so we use an exception catch to reduce conditionals in _get_col
+ if isinstance(key, slice):
+ indices = key.indices(len(row))
+ return tuple([self._get_col(row, i) for i in xrange(*indices)])
+ else:
+ raise
def fetchall(self):
l = []
functions.current_user: 'CURRENT_USER',
functions.localtime: 'LOCALTIME',
functions.localtimestamp: 'LOCALTIMESTAMP',
+ functions.sysdate: 'sysdate',
functions.session_user :'SESSION_USER',
functions.user: 'USER'
}
class session_user(AnsiFunction):
__return_type__ = sqltypes.String
+class sysdate(AnsiFunction):
+ __return_type__ = sqltypes.DateTime
+
class user(AnsiFunction):
__return_type__ = sqltypes.String
if not isinstance(a.type, sqltypes.NullType):
return a.type
else:
- return sqltypes.NullType
\ No newline at end of file
+ return sqltypes.NullType
impl = PickleType
def process_bind_param(self, value, dialect):
- value.stuff = 'this is modified stuff'
+ if value:
+ value.stuff = 'this is modified stuff'
return value
def process_result_value(self, value, dialect):
- value.stuff = 'this is the right stuff'
+ if value:
+ value.stuff = 'this is the right stuff'
return value
class LegacyType(types.TypeEngine):