db_0or1row

one of the documented procedures in this installation of the ACS
Usage:
db_0or1row { -array "" } sql
What it does:
Performs the SQL query $sql, setting variables to column values. Returns 1 if a row is returned, or 0 if no row is returned.
Defined in: /web/philip/packages/acs-core/10-database-procs.tcl

Source code:

arg_parser_for_db_0or1row $args

    db_with_handle db {
	set selection [ns_db 0or1row $db $sql]
	if { ![string compare "" $selection] } {
	    return 0
	} else {
	    if { [string compare $array ""] } {
		upvar $array array_val
	    }
	    
	    for { set i 0 } { $i < [ns_set size $selection] } { incr i } {
		if { [string compare $array ""] } {
		    set array_val([ns_set key $selection $i]) [ns_set value $selection $i]
		} else {
		    upvar [ns_set key $selection $i] value
		    set value [ns_set value $selection $i]
		}
	    }
	    return 1
	}
    }


philg@mit.edu