PHP 클래스 Pheasant\Database\Binder

파일 보기 프로젝트 열기: lox/pheasant 1 사용 예제들

공개 메소드들

메소드 설명
_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