Building a SELECT query.

The join(), select(), and limit() functions should just be passthrus, but I was getting an error when naming a function the same as the class (php4 FTW!) so I had to just move the methods here and call back. Lame I know, but the only other choice was to go back down to 5.2 and name everything with underscores, and I didn't want to do that, so here we are...

package Peyote
author Dave Widmer

 Methods

The only bit of magic in this codebase. This is necessary so we can add mixins.

__call(string $name, $params) : \Peyote\Query
Inherited

inherited_from \Peyote\Query::__call()

Parameters

$name

string

The name of the method to call

$params

Exceptions

\Peyote\Exception

Returns

Optionally sets the table name and initializes the internal class properties.

__construct(string $table) 

Parameters

$table

string

The name of the table

Adds "mixin" methods to this class.

addMethods(string $mixin, array $methods) : \Petoyte\Query
Inherited

inherited_from \Peyote\Query::addMethods()

Parameters

$mixin

string

The name of the mixin

$methods

array

A list of methods to add

Returns

\Petoyte\Query

Specify the columns to select.

columns() : \Peyote\Select

Returns

Specify the columns to select as an array.

columnsArray(array $columns) : \Peyote\Select

Parameters

$columns

array

The columns to select

Returns

Compiles the query into raw SQL

compile() : string

Returns

string

Run a SELECT DISTINCT query.

distinct() : \Peyote\Select

Returns

Gets all of the bound parameters for this query.

getParams() : array

Returns

array

Add a join.

join(string $table, string $type) : \Peyote\Select

Parameters

$table

string

The table name

$type

string

The type of join

Returns

Sets the limit.

limit(int $num) : \Peyote\Select

Parameters

$num

int

The number to limit the queries to

Returns

The offset number.

offset(int $num) : \Peyote\Select

Parameters

$num

int

The number of rows to offset by

Returns

Sets the name of the table.

table(string $name) : \Peyote\Query
Inherited

inherited_from \Peyote\Query::table()

Parameters

$name

string

The table name

Returns

Adds a WHERE clause.

where(string $column, string $op, mixed $value) : \Peyote\Select

Parameters

$column

string

The column name

$op

string

The comparison operator

$value

mixed

The value to bind

Returns

Compiles all of the mixins into an array.

compileMixins() : array
Inherited

inherited_from \Peyote\Query::compileMixins()

Returns

arrayAll of the mixins into an array.

 Properties

 

The group object

$group_by : \Peyote\Group

 

The join object

$join : \Peyote\Join

 

The limit object

$limit : \Peyote\Limit

 

A list of mixins that the query can passthru

$mixins : array

 

The order object

$order_by : \Peyote\Order

 

Bound parameters

$params : array
Inherited

inherited_from \Peyote\Query::$$params
 

The name of the table

$table : string
Inherited

inherited_from \Peyote\Query::$$table
 

The where object

$where : \Peyote\Where

 

A list of columns to search for

$columns : array

 

Run a distinct query?

$is_distinct : boolean

 

A map of passthru methods

$method_map : array
Inherited

inherited_from \Peyote\Query::$$method_map
 

The number to offset by.

$offset_num : int