PHP Класс Pheasant\Database\Binder

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
_bindInto ( $pattern, $sql, $params, $func ) Bind parameters into a particular pattern, skipping quoted strings which might have question marks in them.
bind ( $sql, array $params = [] ) : string Interpolates quoted values in a string with ? in it.
escape ( $string ) : string Escapes any characters not allowed in an SQL string
magicBind ( $sql, array $params = [] ) : string Like bind(), but adds some magic: - a=? becomes a IS NULL if passed null - a!=? or a<>? becomes a IS NOT NULL if passed null - a=? becomes a IN (1, 2, 3) if passed array(1, 2, 3) - a!=? or a<>? becomes a NOT IN (1, 2, 3) if passed array(1, 2, 3)
quote ( $string ) : string Surrounds a string with quote marks, null is returned as NULL, bools converted to 1|empty string for compatibility
reduce ( $array ) : string Reduces an array of values into a bracketed, quoted, comma delimited list
sqlValue ( $mixed ) : string Intelligently quotes/escapes based on the provided type. If an object is passed with a toSql() method, that is used, otherwise the php type is used to infer what needs escaping.

Описание методов

_bindInto() публичный Метод

Bind parameters into a particular pattern, skipping quoted strings which might have question marks in them.
public _bindInto ( $pattern, $sql, $params, $func )

bind() публичный Метод

Interpolates quoted values in a string with ? in it.
public bind ( $sql, array $params = [] ) : string
$params array
Результат string

escape() публичный Метод

Escapes any characters not allowed in an SQL string
public escape ( $string ) : string
Результат string

magicBind() публичный Метод

Like bind(), but adds some magic: - a=? becomes a IS NULL if passed null - a!=? or a<>? becomes a IS NOT NULL if passed null - a=? becomes a IN (1, 2, 3) if passed array(1, 2, 3) - a!=? or a<>? becomes a NOT IN (1, 2, 3) if passed array(1, 2, 3)
public magicBind ( $sql, array $params = [] ) : string
$params array
Результат string

quote() публичный Метод

Surrounds a string with quote marks, null is returned as NULL, bools converted to 1|empty string for compatibility
public quote ( $string ) : string
Результат string

reduce() публичный Метод

Reduces an array of values into a bracketed, quoted, comma delimited list
public reduce ( $array ) : string
Результат string

sqlValue() публичный Метод

Intelligently quotes/escapes based on the provided type. If an object is passed with a toSql() method, that is used, otherwise the php type is used to infer what needs escaping.
public sqlValue ( $mixed ) : string
Результат string