User:Stefan/sqlite

From Scribus Wiki
< User:Stefan
Revision as of 14:22, 22 June 2011 by Stefan (talk | contribs) (Created page with "This works in scribus scripter console ############### import sqlite3 con = sqlite3.connect('mydatabase.db') cur = con.cursor() # cur.execute('CREATE TABLE foo (o_id INTEGER ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This works in scribus scripter console

import sqlite3

con = sqlite3.connect('mydatabase.db') cur = con.cursor()

  1. cur.execute('CREATE TABLE foo (o_id INTEGER PRIMARY KEY, fruit VARCHAR(20), veges VARCHAR(30))')
  2. con.commit()

cur.execute('INSERT INTO foo (o_id, fruit, veges) VALUES(NULL, "apple", "broccoli")') con.commit() print cur.lastrowid cur.execute('SELECT * FROM foo') print cur.fetchall()