Method __getitem__


__getitem__ is a method of the class SapDB_ResultSet.

With this method you position the cursor on a data record in the result set. You use this method to iterate, in a for loop, over all the data records in the result set.


__getitem__ (pos)


Position of the data record

pos=0: First data record in the :result set


?     Data record at the specified position in the result set

?     If the result set is empty/if pos exceeds the number of data records in the result set: None


You iterate across the entire result set with for. The system implicitly calls the __getitem__method and raises the value of the parameter pos in increments of 1 until the method triggers an exception.

for zip, name, state in session.sql ('SELECT * FROM'):

    print zip, name, state