PHP 클래스 SqlBuilder, recess

User: Alexandr Date: 29.09.10
파일 보기 프로젝트 열기: KrisJordan/recess 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$assignments
$conditions * UPDATE & DELETE
$conditionsUsed
$distinct
$groupBy
$joins
$limit
$offset
$orderBy
$select * SELECT
$selectAs
$table * INSERT
$useAssignmentsAsConditions
$usingAliases

공개 메소드들

메소드 설명
assign ( string $column, mixed $value ) : SqlBuilder Assign a value to a column. Used with inserts and updates.
between ( string $column, numeric $small, numeric $big ) : SqlBuilder Shortcut alias for SqlBuilder->lessThan($column,$big)->greaterThan($column,$small)
delete ( ) : string Build a DELETE SQL string from SqlBuilder's state.
distinct ( ) : SqlBuilder Add a DISTINCT clause to SELECT SQL.
equal ( string $column, mixed $value ) : SqlBuilder Equality expression for WHERE clause of update, delete, or select statements.
from ( string $table ) : SqlBuilder Alias to specify which table is being used.
getCriteria ( )
getPdoArguments ( ) : array Return the collection of PDO named parameters and values to be applied to a parameterized PDO statement.
getTable ( )
greaterThan ( string $column, numeric $value ) : SqlBuilder Greater than expression for WHERE clause of update, delete, or select statements.
greaterThanOrEqualTo ( string $column, numeric $value ) : SqlBuilder Greater than or equal to expression for WHERE clause of update, delete, or select statements.
groupBy ( string $clause ) : SqlBuilder Add an GROUP BY expression to sql string. Example: ->groupBy('name')
in ( string $column, array $value ) : SqlBuilder IN to expression for WHERE clause of update, delete, or select statements.
innerJoin ( string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder Inner join expression for SELECT SQL statement.
insert ( ) : string Build an INSERT SQL string from SqlBuilder's state.
into ( string $table ) : SqlBuilder Alias for table (insert into)
isNotNull ( string $column ) : SqlBuilder IS NOT NULL expression for WHERE clause of update, delete, or select statements
isNull ( string $column ) : SqlBuilder IS NULL expression for WHERE clause of update, delete, or select statements
leftOuterJoin ( string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder Left outer join expression for SELECT SQL statement.
lessThan ( string $column, numeric $value ) : SqlBuilder Less than expression for WHERE clause of update, delete, or select statements.
lessThanOrEqualTo ( string $column, numeric $value ) : SqlBuilder Less than or equal to expression for WHERE clause of update, delete, or select statements.
like ( string $column, string $value ) : SqlBuilder LIKE expression for WHERE clause of update, delete, or select statements, does not include wildcards.
limit ( integer $size ) : SqlBuilder LIMIT results to some number of records.
notEqual ( string $column, mixed $value ) : SqlBuilder Inequality than expression for WHERE clause of update, delete, or select statements.
notLike ( string $column, string $value ) : SqlBuilder NOT LIKE expression for WHERE clause of update, delete, or select statements, does not include wildcards.
offset ( integer $offset ) : SqlBuilder When used in conjunction with limit($size), offset specifies which row the results will begin at.
orderBy ( string $clause ) : SqlBuilder Add an ORDER BY expression to sql string. Example: ->orderBy('name ASC')
range ( integer $start, integer $finish ) : SqlBuilder Shortcut alias to ->limit($finish - $start)->offset($start);
select ( ) : string Build a SELECT SQL string from SqlBuilder's state.
selectAs ( string $select, string $as ) : SqlBuilder Add additional field to select statement which is aliased using the AS parameter.
table ( string $table ) : SqlBuilder Set the table of focus on a sql statement.
update ( ) : string Build an UPDATE SQL string from SqlBuilder's state.
useAssignmentsAsConditions ( boolean $bool ) : SqlBuilder Handy shortcut which allows assignments to be used as conditions in a select statement.

보호된 메소드들

메소드 설명
addCondition ( string $column, mixed $value, string $operator ) : SqlBuilder Add a condition to the SqlBuilder statement. Additional logic here to prepend a table name and also keep track of which columns have already been assigned conditions to ensure we do not use two identical named parameters in PDO.
cleansedAssignmentsAsConditions ( ) : array Method for when using assignments as conditions. This purges assignments which have null values.
deleteSanityCheck ( ) Safety check used with delete.
escapeWithTicks ( $string )
groupByHelper ( )
insertSanityCheck ( ) Safety check used with insert to ensure only a table and assignments were applied.
join ( string $leftOrRight, string $innerOrOuter, string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder Generic join expression to be added to a SELECT SQL statement.
joinHelper ( )
orderByHelper ( )
rangeHelper ( )
selectSanityCheck ( ) Safety check used when creating a SELECT statement.
tableAsPrefix ( ) : string Helper method which returns the current table even when it is aliased due to joins between the same table.
updateSanityCheck ( ) Safety check used with update.
whereHelper ( ) * HELPER METHODS

메소드 상세

addCondition() 보호된 메소드

Add a condition to the SqlBuilder statement. Additional logic here to prepend a table name and also keep track of which columns have already been assigned conditions to ensure we do not use two identical named parameters in PDO.
protected addCondition ( string $column, mixed $value, string $operator ) : SqlBuilder
$column string
$value mixed
$operator string
리턴 SqlBuilder

assign() 공개 메소드

Assign a value to a column. Used with inserts and updates.
public assign ( string $column, mixed $value ) : SqlBuilder
$column string
$value mixed
리턴 SqlBuilder

between() 공개 메소드

Shortcut alias for SqlBuilder->lessThan($column,$big)->greaterThan($column,$small)
public between ( string $column, numeric $small, numeric $big ) : SqlBuilder
$column string
$small numeric Greater than this number.
$big numeric Less than this number.
리턴 SqlBuilder

cleansedAssignmentsAsConditions() 보호된 메소드

Method for when using assignments as conditions. This purges assignments which have null values.

delete() 공개 메소드

Build a DELETE SQL string from SqlBuilder's state.
public delete ( ) : string
리턴 string DELETE string

deleteSanityCheck() 보호된 메소드

Safety check used with delete.
protected deleteSanityCheck ( )

distinct() 공개 메소드

Add a DISTINCT clause to SELECT SQL.
public distinct ( ) : SqlBuilder
리턴 SqlBuilder

equal() 공개 메소드

Equality expression for WHERE clause of update, delete, or select statements.
public equal ( string $column, mixed $value ) : SqlBuilder
$column string
$value mixed
리턴 SqlBuilder

escapeWithTicks() 보호된 정적인 메소드

protected static escapeWithTicks ( $string )

from() 공개 메소드

Alias to specify which table is being used.
public from ( string $table ) : SqlBuilder
$table string
리턴 SqlBuilder

getCriteria() 공개 메소드

public getCriteria ( )

getPdoArguments() 공개 메소드

Return the collection of PDO named parameters and values to be applied to a parameterized PDO statement.
public getPdoArguments ( ) : array
리턴 array

getTable() 공개 메소드

public getTable ( )

greaterThan() 공개 메소드

Greater than expression for WHERE clause of update, delete, or select statements.
public greaterThan ( string $column, numeric $value ) : SqlBuilder
$column string
$value numeric
리턴 SqlBuilder

greaterThanOrEqualTo() 공개 메소드

Greater than or equal to expression for WHERE clause of update, delete, or select statements.
public greaterThanOrEqualTo ( string $column, numeric $value ) : SqlBuilder
$column string
$value numeric
리턴 SqlBuilder

groupBy() 공개 메소드

Add an GROUP BY expression to sql string. Example: ->groupBy('name')
public groupBy ( string $clause ) : SqlBuilder
$clause string
리턴 SqlBuilder

groupByHelper() 보호된 메소드

protected groupByHelper ( )

in() 공개 메소드

IN to expression for WHERE clause of update, delete, or select statements.
public in ( string $column, array $value ) : SqlBuilder
$column string
$value array
리턴 SqlBuilder

innerJoin() 공개 메소드

Inner join expression for SELECT SQL statement.
public innerJoin ( string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder
$table string
$tablePrimaryKey string
$fromTableForeignKey string
리턴 SqlBuilder

insert() 공개 메소드

Build an INSERT SQL string from SqlBuilder's state.
public insert ( ) : string
리턴 string INSERT string.

insertSanityCheck() 보호된 메소드

Safety check used with insert to ensure only a table and assignments were applied.
protected insertSanityCheck ( )

into() 공개 메소드

Alias for table (insert into)
public into ( string $table ) : SqlBuilder
$table string
리턴 SqlBuilder

isNotNull() 공개 메소드

IS NOT NULL expression for WHERE clause of update, delete, or select statements
public isNotNull ( string $column ) : SqlBuilder
$column string
리턴 SqlBuilder

isNull() 공개 메소드

IS NULL expression for WHERE clause of update, delete, or select statements
public isNull ( string $column ) : SqlBuilder
$column string
리턴 SqlBuilder

join() 보호된 메소드

Generic join expression to be added to a SELECT SQL statement.
protected join ( string $leftOrRight, string $innerOrOuter, string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder
$leftOrRight string
$innerOrOuter string
$table string
$tablePrimaryKey string
$fromTableForeignKey string
리턴 SqlBuilder

joinHelper() 보호된 메소드

protected joinHelper ( )

leftOuterJoin() 공개 메소드

Left outer join expression for SELECT SQL statement.
public leftOuterJoin ( string $table, string $tablePrimaryKey, string $fromTableForeignKey ) : SqlBuilder
$table string
$tablePrimaryKey string
$fromTableForeignKey string
리턴 SqlBuilder

lessThan() 공개 메소드

Less than expression for WHERE clause of update, delete, or select statements.
public lessThan ( string $column, numeric $value ) : SqlBuilder
$column string
$value numeric
리턴 SqlBuilder

lessThanOrEqualTo() 공개 메소드

Less than or equal to expression for WHERE clause of update, delete, or select statements.
public lessThanOrEqualTo ( string $column, numeric $value ) : SqlBuilder
$column string
$value numeric
리턴 SqlBuilder

like() 공개 메소드

LIKE expression for WHERE clause of update, delete, or select statements, does not include wildcards.
public like ( string $column, string $value ) : SqlBuilder
$column string
$value string
리턴 SqlBuilder

limit() 공개 메소드

LIMIT results to some number of records.
public limit ( integer $size ) : SqlBuilder
$size integer
리턴 SqlBuilder

notEqual() 공개 메소드

Inequality than expression for WHERE clause of update, delete, or select statements.
public notEqual ( string $column, mixed $value ) : SqlBuilder
$column string
$value mixed
리턴 SqlBuilder

notLike() 공개 메소드

NOT LIKE expression for WHERE clause of update, delete, or select statements, does not include wildcards.
public notLike ( string $column, string $value ) : SqlBuilder
$column string
$value string
리턴 SqlBuilder

offset() 공개 메소드

When used in conjunction with limit($size), offset specifies which row the results will begin at.
public offset ( integer $offset ) : SqlBuilder
$offset integer
리턴 SqlBuilder

orderBy() 공개 메소드

Add an ORDER BY expression to sql string. Example: ->orderBy('name ASC')
public orderBy ( string $clause ) : SqlBuilder
$clause string
리턴 SqlBuilder

orderByHelper() 보호된 메소드

protected orderByHelper ( )

range() 공개 메소드

Shortcut alias to ->limit($finish - $start)->offset($start);
public range ( integer $start, integer $finish ) : SqlBuilder
$start integer
$finish integer
리턴 SqlBuilder

rangeHelper() 보호된 메소드

protected rangeHelper ( )

select() 공개 메소드

Build a SELECT SQL string from SqlBuilder's state.
public select ( ) : string
리턴 string

selectAs() 공개 메소드

->selectAs("ABS(location - 5)", 'distance') translates to => SELECT ABS(location-5) AS distance
public selectAs ( string $select, string $as ) : SqlBuilder
$select string
$as string
리턴 SqlBuilder

selectSanityCheck() 보호된 메소드

Safety check used when creating a SELECT statement.
protected selectSanityCheck ( )

table() 공개 메소드

Set the table of focus on a sql statement.
public table ( string $table ) : SqlBuilder
$table string
리턴 SqlBuilder

tableAsPrefix() 보호된 메소드

Helper method which returns the current table even when it is aliased due to joins between the same table.
protected tableAsPrefix ( ) : string
리턴 string The current table which can be used as a prefix.

update() 공개 메소드

Build an UPDATE SQL string from SqlBuilder's state.
public update ( ) : string
리턴 string

updateSanityCheck() 보호된 메소드

Safety check used with update.
protected updateSanityCheck ( )

useAssignmentsAsConditions() 공개 메소드

Handy shortcut which allows assignments to be used as conditions in a select statement.
public useAssignmentsAsConditions ( boolean $bool ) : SqlBuilder
$bool boolean
리턴 SqlBuilder

whereHelper() 보호된 메소드

* HELPER METHODS
protected whereHelper ( )

프로퍼티 상세

$assignments 보호되어 있는 프로퍼티

protected $assignments

$conditions 보호되어 있는 프로퍼티

* UPDATE & DELETE
protected $conditions

$conditionsUsed 보호되어 있는 프로퍼티

protected $conditionsUsed

$distinct 보호되어 있는 프로퍼티

protected $distinct

$groupBy 보호되어 있는 프로퍼티

protected $groupBy

$joins 보호되어 있는 프로퍼티

protected $joins

$limit 보호되어 있는 프로퍼티

protected $limit

$offset 보호되어 있는 프로퍼티

protected $offset

$orderBy 보호되어 있는 프로퍼티

protected $orderBy

$select 보호되어 있는 프로퍼티

* SELECT
protected $select

$selectAs 보호되어 있는 프로퍼티

protected $selectAs

$table 보호되어 있는 프로퍼티

* INSERT
protected $table

$useAssignmentsAsConditions 보호되어 있는 프로퍼티

protected $useAssignmentsAsConditions

$usingAliases 보호되어 있는 프로퍼티

protected $usingAliases