Entering content frame

 Method __getitem__ 

Definition

__getitem__ (pos)

Use

getitem is a method of the class SapDB_ResultSet. You use this method to position the cursor on the record at position pos in the results set, and extract the record. The first record has the position 0.

This method enables you to iterate across all records of a result set in a for loop.

Result

The record is extracted.

If you specify a value for pos that exceeds the number or records in the results set, then the value of the result is None.

You iterate across the entire results set:

for msgno, language, message in session.sql ('SELECT * FROM messages'):
    print msgno, language, message

 

Leaving content frame