Return to Snippet

Revision: 17573
at September 10, 2009 03:36 by manatlan


Updated Code
import sqlite3

c = sqlite3.connect('medialib.db')
sql="SELECT name FROM sqlite_master WHERE type='table';"
r=c.execute(sql)
for row in r.fetchall():
    print row

cur = c.cursor()
cur.execute('CREATE TABLE foo (o_id INTEGER PRIMARY KEY, fruit VARCHAR(20), veges VARCHAR(30))')
con.commit()
cur.execute('INSERT INTO foo (o_id, fruit, veges) VALUES(NULL, "apple", "broccoli")')
con.commit()
print cur.lastrowid

Revision: 17572
at September 9, 2009 17:28 by manatlan


Initial Code
import sqlite3

c = sqlite3.connect('medialib.db')
sql="SELECT name FROM sqlite_master WHERE type='table';"
r=c.execute(sql)
for row in r.fetchall():
    print row

Initial URL


Initial Description


Initial Title
sqlite use cases

Initial Tags
python

Initial Language
Python