Subject | Re: [firebird-support] fdb named parameters |
---|---|
Author | Helen Borrie |
Post date | 2015-02-24T00:26:06Z |
At 10:04 a.m. 24/02/2015, Ernesto Benestante ebenestante@... [firebird-support] wrote:
Please subscribe to the firebird-python list to inquire about the correct Python syntax to do it. You can subscribe at http://www.firebirdsql.org/en/mailing-lists/
^heLen^
>Hi, does FDB support named parameters in queries? Other python databaseThe Firebird SQL engine itself does not support named parameters but most (if not all) client layers do provide mechanisms for them. The syntax will be specific to the driver.
>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?
Please subscribe to the firebird-python list to inquire about the correct Python syntax to do it. You can subscribe at http://www.firebirdsql.org/en/mailing-lists/
^heLen^