Method getDescription

Use

getDescription is a method of the class SapDB_ResultSet.

With this method you display information about the columns in the result set.

Features

getDescription ()

Result:

?     Name of the column

?     Type of the column (as a string)

?     Type of the column (as an integer as per ODBC specification)

These numbers have the same meaning as they do in the ODBC specification.

?     Logical size of the column (maximum number of characters in string columns, maximum number of numbers in numerical columns)

?     Number of decimal places

?     Indicator that specifies whether the column can be NULL

?     The value in the in/out column is always OUT for this method (result set).

Example

?     With the method sql, you execute an SQL statement that returns a result set. With the method getDescription, you display information about the columns of a result set.

cursor = session.sql ("SELECT * FROM hotel.customer")

print "colname  type  code  length  frac  null?  in/out"

print "===================================================="

for columnDescription in cursor.getDescription ():

    print "%-10s %-10s %4d %6d %2d %5s %s" %

columnDescription

colname    type         code length frac  null? in/out

=========================================================

CNO        Fixed         3      4     0    None      OUT

TITLE      Char          1      7     0       1      OUT

FIRSTNAME  Char          1     20     0       1      OUT

NAME       Char          1     20     0    None      OUT

ZIP        Char          1      5     0       1      OUT

ADDRESS    Char          1     40     0    None      OUT

?     Executing SQL Statements and Querying Information About the Result Set