__getitem__ is a method of the SapDB_ResultSet class (sdb.sql module). You can use this method to position the cursor on a data record in the result set and to iterate through all the data records in the result set in a for loop.
Syntax
__getitem__ (pos)
Attribute |
Description |
---|---|
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 or if pos exceeds the number of data records in the result set: None
You iterate through the entire result set using for. The system implicitly calls the __getitem__ method and raises the value of the pos parameter in increments of 1 until the method triggers an exception.
Syntax
for zip, name, state in session.sql ('SELECT * FROM hotel.city'): print zip, name, state