nstcl  >  Documentation  >  nstcl-database  >  db_1row

Tcl Powered!

db_1row

NAME

db_1row — Set variables for a query returning exactly one row

SYNOPSIS

package require nstcl-database ?1.0?
package require nstcl ?1.0?

::nstcl::ns_db1row statement_name SQL ?-column_array array_name | -column_set setId?

DESCRIPTION

Performs the SQL query, setting variables to column values. An error will be raised if either no rows, or multiple rows, are returned.

OPTIONAL SWITCHES

-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.

SEE ALSO

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.

KEYWORDS

database, nstcl