|
|
int Ns_DbGetRow(
Ns_DbHandle *handle,
Ns_Set *row
);
You cannot call Ns_DbDML, Ns_Db1Row, or Ns_Db0or1Row with the same database handle while fetching rows from the database in an Ns_DbGetRow loop. Doing so flushes any waiting rows and a subsequent call to Ns_DbGetRow will fail. You can do so if you use separate database handles.
Ns_DbHandle *handle;
Ns_Set *row;
int status;
handle = Ns_DbPoolGetHandle("mypool");
row = Ns_DbSelect(handle, "select * from mytable");
if (row == NULL) {
/*... handle select error ...*/
}
while ((status = Ns_DbGetRow(handle, row)) == NS_OK) {
/*... process the row fetched from the database ...*/
}
if (status != NS_END_DATA) {
/*... handle get row error ...*/
}