Lines Matching refs:cu
90 cu = self.cx.cursor()
91 cu.execute("create table test(id integer primary key, name text)")
92 cu.execute("insert into test(name) values (?)", ("foo",))
118 cu = self.cx.cursor()
144 cu = cx.cursor()
146 cu.execute("create table transactiontest(id integer primary key, name text)")
148 cu.execute("insert into transactiontest(name) values (?)", ("foo",))
150 cu.execute("select name from transactiontest where name=?", ["foo"])
151 row = cu.fetchone()
155 cu.execute("select name from transactiontest where name=?", ["foo"])
156 row = cu.fetchone()
198 self.cu = self.cx.cursor()
199 self.cu.execute(
203 self.cu.execute("insert into test(name) values (?)", ("foo",))
206 self.cu.close()
210 self.cu.execute("delete from test")
214 self.cu.execute("select asdf")
218 self.cu.execute("select 5+4; select 4+5")
221 self.cu.execute("select 5+4; -- foo bar")
224 self.cu.execute("""
234 self.cu.execute(42)
237 self.cu.execute("insert into test(id) values (?)", (42,))
240 self.cu.execute("insert into test(income) values (?)", (2500.32,))
243 self.cu.execute("insert into test(name) values (?)", ("Hugo",))
246 self.cu.execute("insert into test(name) values (?)", ("Hu\x00go",))
248 self.cu.execute("select name from test where id=?", (self.cu.lastrowid,))
249 row = self.cu.fetchone()
254 self.cu.execute("insert into test(id) values (?)", 42)
260 self.cu.execute("insert into test(id) values (?)", (17, "Egon"))
265 self.cu.execute("insert into test(id) values (?)")
270 self.cu.execute("insert into test(id) values (?)")
273 self.cu.execute("insert into test(name) values ('foo')")
274 self.cu.execute("select name from test where name=?", ["foo"])
275 row = self.cu.fetchone()
286 self.cu.execute("insert into test(name) values ('foo')")
287 self.cu.execute("select name from test where name=?", L())
288 row = self.cu.fetchone()
292 self.cu.execute("insert into test(name) values ('foo')")
293 self.cu.execute("select name from test where name=:name", {"name": "foo"})
294 row = self.cu.fetchone()
302 self.cu.execute("insert into test(name) values ('foo')")
303 self.cu.execute("select name from test where name=:name", D())
304 row = self.cu.fetchone()
308 self.cu.execute("insert into test(name) values ('foo')")
310 self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"})
313 self.cu.execute("insert into test(name) values ('foo')")
315 self.cu.execute("select name from test where name=:name")
318 self.cu.execute("insert into test(name) values ('foo')")
320 self.cu.execute("select name from test where name=?", {"name": "foo"})
323 self.cu.close()
326 self.cu.execute("delete from test")
327 self.cu.execute("insert into test(name) values ('foo')")
328 self.cu.execute("insert into test(name) values ('foo')")
329 self.cu.execute("update test set name='bar'")
330 self.assertEqual(self.cu.rowcount, 2)
338 self.cu.execute("select 5 union select 6")
339 self.assertEqual(self.cu.rowcount, -1)
342 self.cu.execute("delete from test")
343 self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)])
344 self.assertEqual(self.cu.rowcount, 3)
347 self.cu.execute("insert into test(name) values ('foo')")
348 self.cu.execute("insert into test(name) values ('foo')")
356 self.cu.executemany("insert into test(income) values (?)", [(x,) for x in range(100, 110)])
370 self.cu.executemany("insert into test(income) values (?)", MyIter())
377 self.cu.executemany("insert into test(income) values (?)", mygen())
381 self.cu.executemany(42, [(3,)])
385 self.cu.executemany("select ?", [(3,)])
389 self.cu.executemany("insert into test(income) values (?)", 42)
393 self.cu.execute("delete from test")
394 self.cu.execute("insert into test(id) values (?)", (5,))
395 self.cu.execute("insert into test(id) values (?)", (6,))
396 self.cu.execute("select id from test order by id")
398 for row in self.cu:
404 self.cu.execute("select name from test")
405 row = self.cu.fetchone()
407 row = self.cu.fetchone()
417 self.assertEqual(self.cu.arraysize, 1)
420 self.cu.arraysize = 2
423 self.cu.execute("delete from test")
424 self.cu.execute("insert into test(name) values ('A')")
425 self.cu.execute("insert into test(name) values ('B')")
426 self.cu.execute("insert into test(name) values ('C')")
427 self.cu.execute("select name from test")
428 res = self.cu.fetchmany()
433 self.cu.execute("select name from test")
434 res = self.cu.fetchmany(100)
436 res = self.cu.fetchmany(100)
441 self.cu.execute("select name from test")
442 res = self.cu.fetchmany(size=100)
446 self.cu.execute("select name from test")
447 res = self.cu.fetchall()
449 res = self.cu.fetchall()
453 self.cu.setinputsizes([3, 4, 5])
456 self.cu.setoutputsize(5, 0)
459 self.cu.setoutputsize(42)
463 self.assertEqual(self.cu.connection, self.cx)
483 self.cu.execute(sql.format(statement), (1, 'foo'))
484 self.assertEqual(self.cu.lastrowid, 1)
487 self.cu.execute(
490 self.assertEqual(self.cu.lastrowid, 2)
491 self.cu.execute(
494 self.assertEqual(self.cu.lastrowid, 2)
501 self.cu.execute(sql.format(statement), (statement,))
502 results.append((statement, self.cu.lastrowid))
504 self.cu.execute(sql.format(statement), (statement,))
505 results.append((statement, self.cu.lastrowid))
840 self.cu = self.cx.cursor()
841 self.cu.execute("""
848 self.cu.close()
853 self.cu = self.cx.cursor()
855 self.cu.execute("BEGIN")
856 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
857 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
859 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
862 self.cu.execute("SELECT name, unique_name from test")
864 self.assertEqual(self.cu.fetchall(), [])
870 self.cu = self.cx.cursor()
872 self.cu.execute("BEGIN")
873 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
874 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
876 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
878 self.cu.execute("SELECT name, unique_name FROM test")
880 self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
884 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
885 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
887 self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
888 self.cu.execute("SELECT name, unique_name FROM test")
890 self.assertEqual(self.cu.fetchall(), [])
895 self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
896 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
898 self.cu.execute("INSERT OR ABORT INTO test(unique_name) VALUES ('foo')")
900 self.cu.execute("SELECT name, unique_name FROM test")
901 self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
904 self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
906 self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
907 self.assertEqual(self.cu.fetchall(), [])
910 self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
912 self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
913 self.cu.execute("SELECT unique_name FROM test")
914 self.assertEqual(self.cu.fetchall(), [('foo',)])
917 self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Data!', 'foo')")
919 …self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Very different data!', 'f…
920 self.cu.execute("SELECT name, unique_name FROM test")
921 self.assertEqual(self.cu.fetchall(), [('Very different data!', 'foo')])