db_string

one of the documented procedures in this installation of the ACS
Usage:
db_string { -default "*none*" } sql
What it does:
Returns the first column of the result of the SQL query $sql. If the query doesn't return a row, returns $default (or raises an error if no $default is provided).
Defined in: /web/philip/packages/acs-core/10-database-procs.tcl

Source code:

arg_parser_for_db_string $args

    db_with_handle db {
	set selection [ns_db 0or1row $db $sql]
	if { [empty_string_p $selection] } {
	    if { [string compare $default "*none*"] } {
		return $default
	    }
	    error "Selection did not return a value, and no default was provided"
	}
	return [ns_set value $selection 0]
    }


philg@mit.edu