pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindingssupplied. The current statement uses 0, and there are -1 supplied.

F. GEIGER f.geiger at vol.at
Wed May 18 11:46:40 EDT 2005


Thank you Gerhard,

"Gerhard Häring" <gh at ghaering.de> schrieb im Newsbeitrag
news:mailman.117.1116363917.8733.python-list at python.org...
> F. GEIGER wrote:
> > Arrgh, sorry for that post!
> >
> >       self._dbc.execute(q, data)
> >
> > where data is None, works with MySQL. For SQLite I have to write
> >
> >       if data is not None:
> >          self._dbc.execute(q, data)
> >       else:
> >          self._dbc.execute(q)
>
> No, you have to write:
>
> self._dbc.execute(q, (data,))
>
> in both drivers.
>
> i. e. the second parameter to execute *must* be a sequence. Some drivers
> (maybe MySQLdb, too) automatically correct the wrong call and transform a:
>

Okay, that makes sense.


> execute(sql, single_param)
>
> into a
>
> execute(sql, (single_param,))
>
> for you if they notice that "!PySequence_Check(single_param)".
>
> pysqlite 2 does not do this.
>
> HTH,
>
> -- Gerhard

Many thanks again
Franz





More information about the Python-list mailing list