Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import apsw
- class TestVTable:
- def __init__(self, conn):
- self.conn = conn
- def Open(self):
- return TestCursor(self)
- def BestIndex(self, *args):
- return None
- class TestCursor:
- def __init__(self, table):
- self.table = table
- self.offset = 0
- def Filter(self, indexnum, indexname, constraintargs):
- pass
- def Column(self, num):
- if num == -1:
- return self.offset
- else:
- return 'blah'
- def Rowid(self):
- return self.offset
- def Next(self):
- self.offset += 1
- def Eof(self):
- return self.offset > 0
- def Close(self):
- cur=db.cursor()
- for i in range(5):
- cur.execute("insert into timing values ('name',?)", (i,))
- cur.close()
- class TestVTModule:
- def Create( self, connection, modulename, databasename, tablename, *args ):
- return "create table ignored (name,value)", TestVTable(connection)
- # memory database
- db=apsw.Connection("")
- cursor=db.cursor()
- cursor.execute("create table timing (name,totalms)")
- mod = TestVTModule()
- db.createmodule('testvt', mod)
- cursor.execute("create virtual table blah using testvt()")
- cursor.execute("create table abc as select * from blah")
- cursor.execute("create table xyz as select * from blah") # fails on this line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement