FirebirdSQL / fdb

Firebird Driver for Python
https://www.firebirdsql.org/en/devel-python-driver/
Other
60 stars 26 forks source link

I believe I found a procedure bug with a single parameter [PYFB79] #94

Closed firebird-automations closed 5 years ago

firebird-automations commented 5 years ago

Submitted by: Adriano de Souza (azuos777)

work with a firebird 3.0 database and use many procedures with only one input parameter.

When I try to execute a procedure with two paramenters

cursor.callproc ("myproc", (param1, param2)) outputParams = cursor.fetchall () firebird.commit () print (outputParams)

Everything works fine.

But when trying to execute a procedure with only one parameter

cursor.callproc ("mysingleproc", (param1)) outputParams = cursor.fetchall () firebird.commit () print (outputParams)

I get a return error. callproc paremeters must be List or Tuple

firebird-automations commented 5 years ago

Commented by: @pcisar

The parameter list must be a list or tuple. If you want to pass only single parameter as a tuple, you have to add a colon, i.e. (param,) otherwise the Python will handle it as expression and not as tuple constructor. Or use a list, as [para,1] will make a list with single item.

firebird-automations commented 5 years ago
Modified by: @pcisar status: Open \[ 1 \] =\> Resolved \[ 5 \] resolution: Won't Fix \[ 2 \]
firebird-automations commented 5 years ago
Modified by: @pcisar status: Resolved \[ 5 \] =\> Closed \[ 6 \]