getDescription ()
getDescription is a method of the class SapDB_Prepared. You can use this method to extract information about the parameters of an SQL statement.
Each tuple of the result contains the following values:
· Empty string as a placeholder for the name of the parameter
· Type of the parameter as a string
· Type of the parameter as an integer (as with ODBC)
These figures have the same meaning as they do in the ODBC specification.
· Logical size of the parameter
· Number of decimal places
· Indicator that specifies whether the parameter can be NULL
· String 'IN' | 'OUT' | 'IN/OUT'
Generating a stored procedure
session.sql ("""CREATE
DBPROC paramdemo (
IN p1 FIXED (5),
INOUT p2 FIXED,
OUT p3 FLOAT)
AS BEGIN
SET p2 = 2;
SET p3 = 3.0;
END;""")
Generating an object of the class SapDB_Prepared for calling a stored procedure
call = session.prepare ('call paramdemo (?, ?, ?)')
Formatting of the output of the parameter description
print "colname typename code length frac null? in/out"
print "===================================================="
for parameterDescription in call.getDescription ():
print "%-10s %-10s
%4d %6d %2d %5s %s" %
parameterDescription
colname typename code length frac null? in/out
====================================================
Fixed
3
5 0 1 IN
Fixed
3
5 0 1 IN/OUT
Float
6
16 0 1
OUT