DB_common::quoteIdentifier() (Previous) (Next) DB_common::rollback()

View this page in Last updated: Mon, 02 Jul 2007
English | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Plain HTML

DB_common::quoteSmart()

DB_common::quoteSmart() -- Formats input so it can be safely used as a literal

Описание

Format input so it can be safely used as a literal in a query. Literals are values such as strings or numbers which get utilized in places like WHERE, SET and VALUES clauses of SQL statements.

The format returned depends on the PHP data type of input and the database type being used.

Параметр

mixed $in

the input to be quoted

Возвращаемое значение

mixed - the formatted data

The format of the results depends on the input's PHP type:

  • input -> returns

  • NULL -> the string NULL

  • integer or float -> the unquoted number

  • boolean -> output depends on the driver in use

    Most drivers return integers: 1 if true or 0 if false. Some return strings: TRUE if true or FALSE if false. Finally one returns strings: T if true or F if false. Here is a list of each DBMS, the values returned and the suggested column type:

    • dbase -> T/F (Logical)

    • fbase -> TRUE/FALSE (BOOLEAN)

    • ibase -> 1/0 (SMALLINT) [1]

    • ifx -> 1/0 (SMALLINT) [1]

    • msql -> 1/0 (INTEGER)

    • mssql -> 1/0 (TINYINT)

    • mysql -> 1/0 (TINYINT(1))

    • mysqli -> 1/0 (TINYINT(1))

    • oci8 -> 1/0 (NUMBER(1))

    • odbc -> 1/0 (SMALLINT) [1]

    • pgsql -> TRUE/FALSE (BOOLEAN)

    • sqlite -> 1/0 (INTEGER)

    • sybase -> 1/0 (TINYINT)

    [1] Accommodate the lowest common denominator because not all versions of have BOOLEAN.

  • other (including strings and numeric strings) -> a string which has been escaped in a DBMS specific way (using escapeSimple()) and then surrounded by single quotes

Заметка

Эта функция не должна вызываться статически.

Function available since: Release 1.6.0

DB_common::quoteIdentifier() (Previous) (Next) DB_common::rollback()

Download Documentation Last updated: Mon, 02 Jul 2007
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.