nstcl  >  Documentation  >  nstcl-database  >  db_string

Tcl Powered!

db_string

NAME

db_string — Returns the first column from an SQL query

SYNOPSIS

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

::nstcl::db_string statement_name SQL ?-default default_value?

DESCRIPTION

Returns the first column of the result of an SQL query. An error is thrown if the database returns more than one row. Also, if no rows are returned an error will be thrown unless the optional -default switch is provided, in which case the default_value will be returned instead.

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