Subject | pyfirebirdsql: error with very simple parameterized query |
---|---|
Author | skoczian |
Post date | 2011-09-05T15:58:57Z |
Hello,
I can't understand this:
File "<pyshell#31>", line 1, in <module>
curs.execute(sql3, ("Wolle",))
File "C:\Python32\lib\site-packages\firebirdsql\fbcore.py", line 443, in execute
(h, oid, buf) = self.connection._op_response()
File "C:\Python32\lib\site-packages\firebirdsql\fbcore.py", line 1055, in _op_response
raise OperationalError(message, gds_codes, sql_code)
firebirdsql.OperationalError: Dynamic SQL Error
SQL error code = -303
internal error
This query, using a parameter for a numeric database column, works as expected:
['Wolle']
And this works too:
[7]
But I really want to use parameterized queries.
I can't find error code -303 in the Firebird documentation, and I can't understand what's wrong.
Thank you for help,
Sibylle
I can't understand this:
>>> conn = firebirdsql.connect(dsn="localhost:Versand", user="sib", password="immergut", charset="UTF8")Traceback (most recent call last):
>>> sql3 = 'SELECT katnr FROM prodkat WHERE katname = ?'
>>> curs = conn.cursor()
>>> curs.execute(sql3, ("Wolle",))
File "<pyshell#31>", line 1, in <module>
curs.execute(sql3, ("Wolle",))
File "C:\Python32\lib\site-packages\firebirdsql\fbcore.py", line 443, in execute
(h, oid, buf) = self.connection._op_response()
File "C:\Python32\lib\site-packages\firebirdsql\fbcore.py", line 1055, in _op_response
raise OperationalError(message, gds_codes, sql_code)
firebirdsql.OperationalError: Dynamic SQL Error
SQL error code = -303
internal error
This query, using a parameter for a numeric database column, works as expected:
>>> sql4 = "SELECT katname FROM prodkat WHERE katnr = ?"print(x)
>>> curs.execute(sql4, (7,))
>>> for x in curs.fetchall():
['Wolle']
And this works too:
>>> curs.execute("SELECT katnr FROM prodkat WHERE katname = 'Wolle'")print(x)
>>> for x in curs.fetchall():
[7]
But I really want to use parameterized queries.
I can't find error code -303 in the Firebird documentation, and I can't understand what's wrong.
Thank you for help,
Sibylle