by calling the next() method of a TSQLResult i receive one row of the result table. I can do this for every row inside the table. Is it possible to do this twice? I didn’t found a function to rewind the result table.
Unfortunately, there is no possibility to rewind data in TSQLResult object in way you would like. Main reason for this - most sql APIs do not support such feature.
For you two solutions are possible:
Recreate TSQLResult object (via TSQLServer::Query() call) every time you want look through table rows. It is not efficient and you must be sure, that table does not changed in between.
Copy row values in any intermediate object - TTree, for example.
Important remark - it is not allowed to create list of TSQLRow objects - after TSQLResult::Next() call data of previous row may became invalid (the only exception - Oracle).
To optimize your performance, I recommend to use TSQLStatement class - it supports most of basic data types (int, double, …) and much more efficient in memory usage and speed.