self._last_inserted_ids = [proxy().lastrowid]
class SQLiteDialect(ansisql.ANSIDialect):
+ def __init__(self, **kwargs):
+ self.supports_cast = (sqlite.sqlite_version >= "3.2.3")
+ ansisql.ANSIDialect.__init__(self, **kwargs)
def compiler(self, statement, bindparams, **kwargs):
return SQLiteCompiler(self, statement, bindparams, **kwargs)
def schemagenerator(self, *args, **kwargs):
table.columns[col]._set_primary_key()
class SQLiteCompiler(ansisql.ANSICompiler):
+ def visit_cast(self, cast):
+ if self.dialect.supports_cast:
+ super(SQLiteCompiler, self).visit_cast(cast)
+ else:
+ if len(self.select_stack):
+ # not sure if we want to set the typemap here...
+ self.typemap.setdefault("CAST", cast.type)
+ self.strings[cast] = self.strings[cast.clause]
def limit_clause(self, select):
text = ""
if select.limit is not None:
self.context = SessionContext(*args, **kwargs)
def __getattr__(self, name):
return getattr(self.context.current, name)
+ session = property(lambda s:s.context.current)
objectstore = Objectstore(create_session)
self.context = SessionContext(*args, **kwargs)
def __getattr__(self, name):
return getattr(self.context.current, name)
-
+ session = property(lambda s:s.context.current)
+
def assign_mapper(class_, *args, **kwargs):
assignmapper.assign_mapper(objectstore.context, class_, *args, **kwargs)
place_thingy.drop()
place.drop()
transition.drop()
+ objectstore.clear()
+ clear_mappers()
#testbase.db.tables.clear()
self.uninstall_threadlocal()
enrolTbl.drop()
studentTbl.drop()
courseTbl.drop()
+ objectstore.clear()
+ clear_mappers()
#testbase.db.tables.clear()
self.uninstall_threadlocal()
c2a1.drop()
a.drop()
c.drop()
+ objectstore.clear()
+ clear_mappers()
#testbase.db.tables.clear()
self.uninstall_threadlocal()