annotate Doc/lib/sqlite3/createdb.py @ 39042:c02fa187e0f4 legacy-trunk

Part of SF patch #1484695. This removes dead code. The chksum was already verified in .frombuf() on the lines above. If there was a problem an exception is raised, so there was no way this condition could have been true.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 10 Jul 2006 00:23:17 +0000
parents 204ec383b445
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38197
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
1 # Not referenced from the documentation, but builds the database file the other
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
2 # code snippets expect.
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
3
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
4 import sqlite3
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
5 import os
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
6
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
7 DB_FILE = "mydb"
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
8
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
9 if os.path.exists(DB_FILE):
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
10 os.remove(DB_FILE)
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
11
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
12 con = sqlite3.connect(DB_FILE)
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
13 cur = con.cursor()
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
14 cur.execute("""
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
15 create table people
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
16 (
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
17 name_last varchar(20),
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
18 age integer
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
19 )
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
20 """)
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
21
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
22 cur.execute("insert into people (name_last, age) values ('Yeltsin', 72)")
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
23 cur.execute("insert into people (name_last, age) values ('Putin', 51)")
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
24
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
25 con.commit()
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
26
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
27 cur.close()
204ec383b445 Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents: 38069
diff changeset
28 con.close()