/Doc/includes/sqlite3/executescript.py

http://unladen-swallow.googlecode.com/ · Python · 24 lines · 23 code · 1 blank · 0 comment · 0 complexity · a640f6fd15777ca696e0860e6f13b2f6 MD5 · raw file

  1. import sqlite3
  2. con = sqlite3.connect(":memory:")
  3. cur = con.cursor()
  4. cur.executescript("""
  5. create table person(
  6. firstname,
  7. lastname,
  8. age
  9. );
  10. create table book(
  11. title,
  12. author,
  13. published
  14. );
  15. insert into book(title, author, published)
  16. values (
  17. 'Dirk Gently''s Holistic Detective Agency',
  18. 'Douglas Adams',
  19. 1987
  20. );
  21. """)