Execute an SQL statement that must return one row
Ns_Set *Ns_Db1Row( Ns_DbHandle *handle, char *sql );
The Ns_Db1Row function calls the Ns_Db0or1Row function with the given SQL statement. If Ns_Db0or1Row returns 1 row, Ns_Db1Row returns the newly allocated Ns_Set for the row. You must eventually free this row using Ns_SetFree. If NsDb0or1Row returns zero rows, Ns_Db1Row returns NULL.
If the SQL statement returns zero rows or a database error has occurred, Ns_Db1Row returns NULL. Detailed error messages may have accumulated in an internal buffer in the Ns_DbHandle. These errors can be conveyed back to the user through the Ns_DbReturnError function.
Ns_Set *row; Ns_DbHandle *handle; if ((handle = Ns_DbPoolGetHandle("aPoolName")) != NULL) { row = Ns_Db1Row(handle, "select aName from aTable"); if (row != NULL) { char *value; value = Ns_SetGet(row, "aName"); /* use `value' here */ Ns_SetFree(row); } }