logo       

Re: Emulating a sequence: msg#00025

python.db.pysqlite.user

Subject: Re: Emulating a sequence

Hi Greg. I tried this before quoting. Here is what I had done and the
error. Can you spot the problem?

This is what I had tried:

stmt = """
update sequence
set commit_seq = commit_seq + 1
where id=1;
insert into ztransaction (
tid, commit_order, username, description, extension)
values (?, (select commit_seq from sequence where id=1), ?, ?, ?);
"""
cursor.executescript(stmt, (tid_int, user, desc, ext))

The error:
cursor.executescript(stmt, (tid_int, user, desc, ext))
TypeError: function takes exactly 1 argument (2 given)

Regards,
David

ggivler-zdgUFu1MqnQ@xxxxxxxxxxxxxxxx wrote:
> Replace your %s with ? and things should work...
>
> It will handle the quotes and stuff for you.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise