Lines Matching refs:cursor

78                     with contextlib.closing(self.connection.cursor()) as cursor:
79 return f(self, cursor, *args, **kwargs)
92 def _setup_database(self, cursor): argument
93 cursor.execute("pragma synchronous = off;")
97 cursor.execute("pragma journal_mode = WAL;")
98 cursor.execute("pragma wal_autocheckpoint = 100;")
109 def _execute_single(self, cursor, *query): argument
114 cursor.execute(*query)
124 def __init__(self, cursor): argument
125 self.cursor = cursor
131 row = self.cursor.fetchone()
133 self.cursor.close()
141 self.cursor.close()
144 cursor = self.connection.cursor()
146 cursor.execute(*query)
147 return CursorIter(cursor)
149 cursor.close()
160 def __getitem__(self, cursor, key): argument
161 cursor.execute("SELECT * from %s where key=?;" % self.table, [key])
162 row = cursor.fetchone()
169 def __delitem__(self, cursor, key): argument
172 cursor.execute("DELETE from %s where key=?;" % self.table, [key])
176 def __setitem__(self, cursor, key, value): argument
183 cursor.execute("BEGIN EXCLUSIVE")
185 cursor.execute("SELECT * from %s where key=?;" % self.table, [key])
186 row = cursor.fetchone()
188 cursor.execute("UPDATE %s SET value=? WHERE key=?;" % self.table, [value, key])
190 cursor.execute("INSERT into %s(key, value) values (?, ?);" % self.table, [key, value])
194 def __contains__(self, cursor, key): argument
195 cursor.execute('SELECT * from %s where key=?;' % self.table, [key])
196 return cursor.fetchone() is not None
200 def __len__(self, cursor): argument
201 cursor.execute("SELECT COUNT(key) FROM %s;" % self.table)
202 row = cursor.fetchone()
235 def clear(self, cursor): argument
236 cursor.execute("DELETE FROM %s;" % self.table)