The XSB-ODBC interface is limited to using 100 open cursors. When XSB systems use database accesses in a complicated manner, management of open cursors can be a problem due to the tuple-at-a-time access of databases from Prolog, and due to leakage of cursors through cuts and throws. Often, it is more efficient to call the database through set-at-a-time predicates such as findall/3, and then to backtrack through the returned information. For instance, the predicate findall_odbc_sql/4 can be defined as:
findall_odbc_sql(ConnName,BindVals,SQLStmt,ResultRow):-
findall(Res,odbc_sql(ConnName,BindVals,SQLStmt,Res),Results),
member(ResultRow,Results).
As a convenience, therefore, the predicates findall_odbc_sql/3
and findall_odbc_sql/4 are defined in the ODBC interface.