symbian-qemu-0.9.1-12/python-2.6.1/Doc/includes/sqlite3/shortcut_methods.py
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 import sqlite3
       
     2 
       
     3 persons = [
       
     4     ("Hugo", "Boss"),
       
     5     ("Calvin", "Klein")
       
     6     ]
       
     7 
       
     8 con = sqlite3.connect(":memory:")
       
     9 
       
    10 # Create the table
       
    11 con.execute("create table person(firstname, lastname)")
       
    12 
       
    13 # Fill the table
       
    14 con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
       
    15 
       
    16 # Print the table contents
       
    17 for row in con.execute("select firstname, lastname from person"):
       
    18     print row
       
    19 
       
    20 # Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
       
    21 print "I just deleted", con.execute("delete from person where 1=1").rowcount, "rows"