Installation guide

5. mxODBC Overview
parameters, parametertypes)
The return value from the function will be passed back as first parameter.
Accordingly, the first entry in
parametertypes must be set to
SQL.PARAM_OUTPUT.
Example:
from mx.ODBC.unixODBC import SQL
results = cursor.execute(
'{? = call function_params(?,?)}',
[0, 1, 0],
parametertypes=(SQL.PARAM_OUTPUT,
SQL.PARAM_INPUT,
SQL.PARAM_OUTPUT))
if results == (4, 1, 2):
print 'Works.'
Retrieving result sets from stored procedures
In case the stored procedure generates one or more result sets, these can be
fetched using the standard
cursor.fetch*() methods. If the stored procedure
has generate multiple result sets, skipping to the next result set is possible by
calling the
.nextset() cursor method.
Please see section 5.6.5 Using Result Sets for passing back Output Data for
details.
Example:
cursor.execute('{call sp_result_set(?)}', [1])
result_set = cursor.fetchall()
5.6.3 Input/Output and Output Parameters
The mxODBC default assumption for bound parameters is to use input
parameters. These don't require additional information to be processed by
mxODBC.
ODBC and several databases also support output parameters (parameters which
don't have an input value, but are used for sending output back to the caller) and
input/output parameters (which are read for input and send data as output).
parametertypes Parameter
In order to tell which parameters are input/output or output parameters, mxODBC
needs additional information in form of a
parametertypes sequence. This
sequence defines the type of parameter for each bound parameter in the order
they appear in the executed command or stored procedure definition.
The following types of parameters are supported. They are defined through the
SQL lookup variable which is available in all mxODBC subpackages.
71