Ns dbquotevalue

From AOLserver Wiki
Revision as of 20:02, 7 February 2009 by Gustafn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Man page: http://aolserver.com/docs/tcl/ns_dbquotevalue.html


NAME

ns_dbquotevalue - Prepare a value string for inclusion in an SQL statement.

SYNOPSIS

ns_dbquotevalue value ?type?

DESCRIPTION

This command prepares the string value for inclusion in an SQL statement. If value is "", ns_dbquotevalue will return the string "NULL". If value is not "", the returned value depends on type. If type is one of: bigint, bit, decimal, double, float, int, integer, numeric, real, smallint, or tinyint, then value will be returned without modification. When type is any other string, or if type is omitted, value will be surrounded by single quotes, and any single quotes that it contains will be escaped by translation into two single quotes.

EXAMPLES

   % ns_dbquotevalue ""
   NULL
   % ns_dbquotevalue 45.3 float
   45.3
   % ns_dbquotevalue "John's Car"
   'John''s Car'
   % set company "John's Cheese Factory"
   % ns_db dml $db "INSERT INTO companies (name) VALUES ([ns_dbquotevalue $company])"

SEE ALSO

ns_dbquotename