More DBI question
Timothy Grant
tjg at avalongroup.net
Tue Jan 18 14:16:24 EST 2000
Hi again, I begin to feel like a pest,
I guess I have a misunderstanding of how cursors are supposed work, or
more likely how I am supposed to work with cursors.
Current understanding:
Open Database Connection
Create a Cursor
Execute SQL queries using that cursor
Process results
Now, I need to make all sorts of different queries using that cursor,
some are selects, some are updates, some are deletes, some deal with
functions
Now my misunderstanding comes when I do something like this
c.execute("""SELECT NEXTVAL ('id')""")
c.execute("""INSERT INTO mytable ( name, rank, serialno)
VALUES( ?, ?, ?""", (namevar, rankvar, serialnovar))
This works as advertised
Howevever, the second time through this sequence, the first execute
returns an error along the lines of "Expecting 3 arguments received 1"
Now I understand where the three arguments part comes from, the cursor
just did something that required three arguments, but how do I "reset"
what the cursor expects, it seems clunky to call a db.commit() after
each execute.
--
Stand Fast,
tjg.
Chief Technology Officer tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. (503) 246-3630
>>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
More information about the Python-list
mailing list