getDescription ()
getDescription is a method of the class SapDB_ResultSet. You can use this method to extract information about the columns of a results set.
This method gets a description of the results set.
Each tuple of the result contains the following values:
· Name of the column
· Type of the column as a string
· Type of the column as an integer
These figures have the same meaning as they do in the ODBC specification.
· Logical size of the column
· Number of decimal places
· Indicator that specifies whether the column can contain NULL
· String OUT
Generating a results set and the formatted output of the column descriptions
cursor = session.sql
("SELECT * FROM messages")
print "colname
typename code length
frac null? in/out"
print "===================================================="
for columnDescription in cursor.getDescription ():
print "%-10s %-10s
%4d %6d %2d %5s %s" % columnDescription
colname typename code length frac null? in/out
====================================================
MSGNO
Fixed
3
5 0 None OUT
LANGUAGE Char
1
3 0 None OUT
MSGTEXT Unicode 1 80 0 1
OUT