|
db_0or1row Set variables for a query returning at most one row
package require nstcl-database ?1.0?
package require nstcl ?1.0?
::nstcl::ns_db0or1row statement_name SQL ?-column_array array_name | -column_set setId ?
Performs the SQL query, setting variables to column values if one row is returned. No variables are set if no rows are returned. An error will be raised if multiple rows are returned. ns_db0or1row will return the number of rows returned (0 or 1).
- -column_array array_name
- Instead of setting individual variables (foo, bar, etc.), set each column in the result row as a field in array_name (i.e. array_name(foo), array_name(bar), etc.)
- -column_set setId
- Instead of setting individual variables, updates the ns_set referenced by setId with the key/value pairs returned by the database.
The documentation for the database_api for information on statement_name and which database pool is used to evaluate SQL when multiple pools are defined.
database, nstcl