Installation guide

mxODBC - Python ODBC Database Interface
SQL.PARAM_INPUT
The parameter is an input parameter. Output values are not allowed and may
raise a database error or simply be ignored (this depends on the ODBC driver
and database).
SQL.PARAM_OUTPUT
The parameter is an output parameter. Input values are ignored.
Since mxODBC does not always have an efficient possibility to query the
output type of the stored procedure, the type of the corresponding parameter
value in the input parameters sequence is used as hint to the output type. Even
though the value itself is ignored, it should therefore match the expected
output type of the output parameter
7
.
SQL.PARAM_INPUT_OUTPUT
The parameter is a combination of input and output parameter. Input values
are passed to the command/stored procedure parameters. After execution of
the command/stored procedure, the output values are read back from the
database.
Note: The parametertypes parameter and - as a result - output and
input/output parameters are not supported for 'named' parameter style mode.
This may change in future mxODBC versions.
Example for cursor.execute():
from mx.ODBC.unixODBC import SQL
results = cursor.execute('{call get_max_value(?, ?)}',
(1, 3),
parametertypes=(SQL.PARAM_INPUT,
SQL.PARAM_INPUT_OUTPUT))
Example for cursor.callproc():
from mx.ODBC.unixODBC import SQL
results = c.callproc('get_max_value',
(1, 3),
parametertypes=(SQL.PARAM_INPUT,
SQL.PARAM_INPUT_OUTPUT))
Dynamically determining the Parameter Type
In some situations it may not be possible to determine the parameters
beforehand, e.g. when dynamically creating a stored procedure call.
Fortunately, the cursor catalog methods provide a way to determine which
parameters are input, output or input/output parameters via the
cursor.procedurecolumns() method.
7
Some ODBC drivers/database backends can provide type information for output
parameters in stored procedures, but others fail to provide usable information. If you run
into problems with data type conversion errors, please try setting the
cursor.bindmethod
to
BIND_USING_PYTHONTYPE before running the procedure call.
72