Re: Incompatible Data Type?

Adrian Klaver <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On Tuesday 26 December 2006 2:32 pm, Rich Shepard wrote:
>    I finally isolated a problem that occurs when I try to add a new record
> to a table. Here's the embedded SQL:
>
>  	self.appData.cur.execute("insert into variable(var_name, var_alpha_cut)
> values(?,?)", (self.vn, self.va))
>
> and here's what python/pysqlite2 reports:
>
> Traceback (most recent call last):
>    File "/data1/eikos/variablePage.py", line 367, in OnVarSave
>      self.appData.cur.execute("insert into variable(var_name,
> var_alpha_cut) values(?,?)", (self.vn, self.va))
> pysqlite2.dbapi2.InterfaceError: Error binding parameter 1 - probably
> unsupported type
>
>    Parameter 1 is self.va. That's a real (e.g., a print statement prior to
> the SQL produces 0.18000000000000000000). The table schema defines the
> column, 'var_alpha_cut,' to be REAL. Therefore, I don't understand why
> there is a binding problem. Unless the wxPython widget type has too many
> zeros while the pysqlite REAL type is 8 bytes in size. I would have thought
> that the trailing zeros would be snipped off.
>
>    What am I missing?
>
> Rich
I tried to replicate the problem and could not. I suspect it is the self.* 
variables. Will the statement execute without them?  For instance:

self.appData.cur.execute("insert into variable(var_name, var_alpha_cut)
values(?,?)", ('name',0.18000000000000000000))

My guess is you are not picking up the correct variable.
-- 
Adrian Klaver
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.