[ python-Bugs-1738670 ] sqlite3 doc fix
SourceForge.net
noreply at sourceforge.net
Sun Jun 17 20:50:01 CEST 2007
Bugs item #1738670, was opened at 2007-06-17 08:08
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1738670&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Mark Carter (comcol)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: sqlite3 doc fix
Initial Comment:
I ran the example given at
http://docs.python.org/lib/module-sqlite3.html
but it didn't affect the database because no commit() was made. This is a "gotcha" that will affect others, too. I recommend appending the example:
---begin
conn = sqlite3.connect('/tmp/example')
# ...
c = conn.cursor()
# Create table
c.execute('''create table stocks
(date text, trans text, symbol text,
qty real, price real)''')
# Insert a row of data
c.execute("""insert into stocks
values ('2006-01-05','BUY','RHAT',100,35.14)""")
---end
with the lines:
# commit the changes, and close out
c.close()
conn.commit() # make the changes "stick"
conn.close()
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-06-17 11:50
Message:
Logged In: YES
user_id=33168
Originator: NO
Thanks for the report. I updated the example and tested it. I did a
slightly different change by doing the commit first and optionally closing
the cursor.
Committed revision 56009.
Committed revision 56010. (2.5)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1738670&group_id=5470
More information about the Python-bugs-list
mailing list