db_foreach

EveAndersson.com : API Browser : db_foreach

db_foreach

db_foreach statement_name sql [ args... ]
Defined in packages/acs-core/10-database-procs.tcl

Usage: db_foreach statement_name sql [-bind ns_set | list of bind variables] code_block [if_no_rows if_no_rows_code_block] Performs the SQL query $sql, executing code_block once for each row with variables set to column values.

Example:

db_foreach greeble_query "select foo, bar from greeble" {
    ns_write "<li>foo=$foo; bar=$bar\n"
} if_no_rows {
    # This block is optional.
    ns_write "<li>No greebles!\n"
}

Parameters:
statement_name
sql
[ show source ]

Show another procedure:

eve@eveandersson.com