Lines Matching refs:cu
93 cu = self.cx.cursor()
94 cu.execute("create table test(id integer primary key, name text)")
95 cu.execute("insert into test(name) values (?)", ("foo",))
121 cu = self.cx.cursor()
147 cu = cx.cursor()
149 cu.execute("create table transactiontest(id integer primary key, name text)")
151 cu.execute("insert into transactiontest(name) values (?)", ("foo",))
153 cu.execute("select name from transactiontest where name=?", ["foo"])
154 row = cu.fetchone()
158 cu.execute("select name from transactiontest where name=?", ["foo"])
159 row = cu.fetchone()
190 self.cu = self.cx.cursor()
191 self.cu.execute(
195 self.cu.execute("insert into test(name) values (?)", ("foo",))
198 self.cu.close()
202 self.cu.execute("delete from test")
206 self.cu.execute("select asdf")
210 self.cu.execute("select 5+4; select 4+5")
213 self.cu.execute("select 5+4; -- foo bar")
216 self.cu.execute("""
226 self.cu.execute(42)
229 self.cu.execute("insert into test(id) values (?)", (42,))
232 self.cu.execute("insert into test(income) values (?)", (2500.32,))
235 self.cu.execute("insert into test(name) values (?)", ("Hugo",))
238 self.cu.execute("insert into test(name) values (?)", ("Hu\x00go",))
240 self.cu.execute("select name from test where id=?", (self.cu.lastrowid,))
241 row = self.cu.fetchone()
246 self.cu.execute("insert into test(id) values (?)", 42)
252 self.cu.execute("insert into test(id) values (?)", (17, "Egon"))
257 self.cu.execute("insert into test(id) values (?)")
262 self.cu.execute("insert into test(id) values (?)")
265 self.cu.execute("insert into test(name) values ('foo')")
266 self.cu.execute("select name from test where name=?", ["foo"])
267 row = self.cu.fetchone()
278 self.cu.execute("insert into test(name) values ('foo')")
279 self.cu.execute("select name from test where name=?", L())
280 row = self.cu.fetchone()
284 self.cu.execute("insert into test(name) values ('foo')")
285 self.cu.execute("select name from test where name=:name", {"name": "foo"})
286 row = self.cu.fetchone()
294 self.cu.execute("insert into test(name) values ('foo')")
295 self.cu.execute("select name from test where name=:name", D())
296 row = self.cu.fetchone()
300 self.cu.execute("insert into test(name) values ('foo')")
302 self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"})
305 self.cu.execute("insert into test(name) values ('foo')")
307 self.cu.execute("select name from test where name=:name")
310 self.cu.execute("insert into test(name) values ('foo')")
312 self.cu.execute("select name from test where name=?", {"name": "foo"})
315 self.cu.close()
318 self.cu.execute("delete from test")
319 self.cu.execute("insert into test(name) values ('foo')")
320 self.cu.execute("insert into test(name) values ('foo')")
321 self.cu.execute("update test set name='bar'")
322 self.assertEqual(self.cu.rowcount, 2)
330 self.cu.execute("select 5 union select 6")
331 self.assertEqual(self.cu.rowcount, -1)
334 self.cu.execute("delete from test")
335 self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)])
336 self.assertEqual(self.cu.rowcount, 3)
339 self.cu.execute("insert into test(name) values ('foo')")
340 self.cu.execute("insert into test(name) values ('foo')")
348 self.cu.executemany("insert into test(income) values (?)", [(x,) for x in range(100, 110)])
362 self.cu.executemany("insert into test(income) values (?)", MyIter())
369 self.cu.executemany("insert into test(income) values (?)", mygen())
373 self.cu.executemany(42, [(3,)])
377 self.cu.executemany("select ?", [(3,)])
381 self.cu.executemany("insert into test(income) values (?)", 42)
385 self.cu.execute("delete from test")
386 self.cu.execute("insert into test(id) values (?)", (5,))
387 self.cu.execute("insert into test(id) values (?)", (6,))
388 self.cu.execute("select id from test order by id")
390 for row in self.cu:
396 self.cu.execute("select name from test")
397 row = self.cu.fetchone()
399 row = self.cu.fetchone()
409 self.assertEqual(self.cu.arraysize, 1)
412 self.cu.arraysize = 2
415 self.cu.execute("delete from test")
416 self.cu.execute("insert into test(name) values ('A')")
417 self.cu.execute("insert into test(name) values ('B')")
418 self.cu.execute("insert into test(name) values ('C')")
419 self.cu.execute("select name from test")
420 res = self.cu.fetchmany()
425 self.cu.execute("select name from test")
426 res = self.cu.fetchmany(100)
428 res = self.cu.fetchmany(100)
433 self.cu.execute("select name from test")
434 res = self.cu.fetchmany(size=100)
438 self.cu.execute("select name from test")
439 res = self.cu.fetchall()
441 res = self.cu.fetchall()
445 self.cu.setinputsizes([3, 4, 5])
448 self.cu.setoutputsize(5, 0)
451 self.cu.setoutputsize(42)
455 self.assertEqual(self.cu.connection, self.cx)
475 self.cu.execute(sql.format(statement), (1, 'foo'))
476 self.assertEqual(self.cu.lastrowid, 1)
479 self.cu.execute(
482 self.assertEqual(self.cu.lastrowid, 2)
483 self.cu.execute(
486 self.assertEqual(self.cu.lastrowid, 2)
493 self.cu.execute(sql.format(statement), (statement,))
494 results.append((statement, self.cu.lastrowid))
496 self.cu.execute(sql.format(statement), (statement,))
497 results.append((statement, self.cu.lastrowid))
833 self.cu = self.cx.cursor()
834 self.cu.execute("""
841 self.cu.close()
846 self.cu = self.cx.cursor()
848 self.cu.execute("BEGIN")
849 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
850 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
852 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
855 self.cu.execute("SELECT name, unique_name from test")
857 self.assertEqual(self.cu.fetchall(), [])
863 self.cu = self.cx.cursor()
865 self.cu.execute("BEGIN")
866 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
867 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
869 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
871 self.cu.execute("SELECT name, unique_name FROM test")
873 self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
877 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
878 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
880 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
881 self.cu.execute("SELECT name, unique_name FROM test")
883 self.assertEqual(self.cu.fetchall(), [])
888 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
889 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
891 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
893 self.cu.execute("SELECT name, unique_name FROM test")
894 self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
897 self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
899 self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
900 self.assertEqual(self.cu.fetchall(), [])
903 self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
905 self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
906 self.cu.execute("SELECT unique_name FROM test")
907 self.assertEqual(self.cu.fetchall(), [('foo',)])
910 self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Data!', 'foo')")
912 …self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Very different data!', 'f…
913 self.cu.execute("SELECT name, unique_name FROM test")
914 self.assertEqual(self.cu.fetchall(), [('Very different data!', 'foo')])