db_uri = 'sqlite://%s' % db_file.replace(os.sep, '/')
-sqlhub.processConnection = connectionForURI(db_uri)
+
+sqlhub.processConnection = connection = connectionForURI(db_uri)
+
+if connection.dbName == 'sqlite':
+ # Speedup SQLite connection
+ connection.query("PRAGMA synchronous=OFF")
+ connection.query("PRAGMA count_changes=OFF")
+ connection.query("PRAGMA journal_mode=MEMORY")
+ connection.query("PRAGMA temp_store=MEMORY")
class Author(SQLObject):
return
-def insert_name(table, name):
+def insert_name(table, name, **kw):
try:
return table.byName(name)
except SQLObjectNotFound:
- return table(name=name, count=0)
+ return table(name=name, count=0, **kw)
def test():