Tcl API Reference -- ns_dbquotevalue

### ns_dbquotevalue

#### Overview

Prepare a value string for inclusion in an SQL statement

#### Syntax

ns_dbquotevalue value {type text}

#### Description

ns_dbquotevalue prepares a value string for inclusion in an SQL statement. The value is of type text by default. Values of a numeric type in the value string are left alone. A value string of "" is translated into NULL. All other values are surrounded by single quotes, and any single quotes included in the value are escaped (translated into two single quotes).

#### Example

        set value "Charlie's Cheese Factory"
        ns_db dml $db \
        "insert into companies(name) values ([ns_dbquotevalue $value])"

Top of Page
Copyright © 1998-99 America Online, Inc.