test-sqlite3.py 361 B

123456789101112
  1. import sqlite3
  2. ver = sqlite3.sqlite_version
  3. con = sqlite3.connect(':memory:', 1, sqlite3.PARSE_DECLTYPES, None)
  4. cur = con.cursor()
  5. cur.execute('CREATE TABLE test (id INT, txt TEXT)')
  6. cur.execute('INSERT INTO test VALUES (?, ?)', (42, 'wut'))
  7. cur.execute('SELECT * FROM test')
  8. assert(cur.fetchall() == [(42, 'wut')])
  9. cur.execute('DROP TABLE test')
  10. con.close()