Subject | fdb named parameters |
---|---|
Author | Ernesto Benestante |
Post date | 2015-02-23T21:04:23Z |
Hi, does FDB support named parameters in queries? Other python database
adapters support specifying a name for the parameters in the SQL string
and passing a dict to execute(), to bind the parameters to its values.
Something like this:
cur.execute('select * from customers where id = %(cid)d', {'cid': 3})
That does not work with FDB:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/fdb/fbcore.py", line
3352, in execute
self._ps = PreparedStatement(operation, self, True)
File "/usr/local/lib/python3.4/dist-packages/fdb/fbcore.py", line
1985, in __init__
"Error while preparing SQL statement:")
fdb.fbcore.DatabaseError: ('Error while preparing SQL statement:\n-
SQLCODE: -104\n- Dynamic SQL Error\n- SQL error code = -104\n- Token
unknown - line 1, column 37\n- %', -104, 335544569)
Is there another way?
Thanks...
adapters support specifying a name for the parameters in the SQL string
and passing a dict to execute(), to bind the parameters to its values.
Something like this:
cur.execute('select * from customers where id = %(cid)d', {'cid': 3})
That does not work with FDB:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/fdb/fbcore.py", line
3352, in execute
self._ps = PreparedStatement(operation, self, True)
File "/usr/local/lib/python3.4/dist-packages/fdb/fbcore.py", line
1985, in __init__
"Error while preparing SQL statement:")
fdb.fbcore.DatabaseError: ('Error while preparing SQL statement:\n-
SQLCODE: -104\n- Dynamic SQL Error\n- SQL error code = -104\n- Token
unknown - line 1, column 37\n- %', -104, 335544569)
Is there another way?
Thanks...