Method |
Description |
|
__call ( string $name, array $args ) : Result | lessql\Row | null |
Returns a result for table $name. |
|
__construct ( PDO $pdo ) |
Constructor. Sets PDO to exception mode. |
|
begin ( ) : boolean |
Begin a transaction |
|
commit ( ) : boolean |
Commit changes of transaction |
|
createResult ( Database | Result | lessql\Row $parent, string $name ) : Result |
Create a result bound to $parent using table or association $name. |
|
createRow ( string $name, array $properties = [], Result | null $result = null ) : lessql\Row |
Create a row from given properties. |
|
delete ( string $table, array $where = [], array $params = [] ) : PDOStatement |
Execute delete query and return statement |
|
format ( mixed $value ) : string |
Format a value for SQL, e.g. DateTime objects |
|
getAlias ( string $alias ) : string |
Get alias of a table |
|
getBackReference ( string $table, string $name ) : string |
Get a back reference key for an association on a table |
|
getIdentifierDelimiter ( ) : string |
Get identifier delimiter |
|
getPrimary ( string $table ) : string | array |
Get primary key of a table, may be array for compound keys |
|
getReference ( string $table, string $name ) : string |
Get a reference key for an association on a table |
|
getRequired ( string $table ) : array |
Get a map of required columns of a table |
|
getSequence ( string $table ) : null | string |
Get primary sequence name of table (used in INSERT by Postgres) |
|
getSuffix ( array $where, array $orderBy = [], integer | null $limitCount = null, integer | null $limitOffset = null ) : string |
Return WHERE/LIMIT/ORDER suffix for queries |
|
insert ( string $table, array $rows, string | null $method = null ) : PDOStatement | null |
Insert one ore more rows into a table |
|
is ( string $column, string | array $value, boolean $not = false ) : string |
Build an SQL condition expressing that "$column is $value",
or "$column is in $value" if $value is an array. Handles null
and literals like new Literal( "NOW()" ) correctly. |
|
isNot ( string $column, string | array $value ) : string |
Build an SQL condition expressing that "$column is not $value"
or "$column is not in $value" if $value is an array. Handles null
and literals like new Literal( "NOW()" ) correctly. |
|
isRequired ( string $table, string $column ) : boolean |
Is a column of a table required for saving? Default is no |
|
lastInsertId ( string | null $sequence = null ) : string |
Return last inserted id |
|
literal ( string $value ) : lessql\Literal |
Create a SQL Literal |
|
onQuery ( string $query, array $params = [] ) |
Calls the query callback, if any |
|
prepare ( string $query ) : PDOStatement |
Prepare an SQL statement |
|
query ( string $query ) : PDOStatement |
Execute an SQL statement directly |
|
quote ( mixed $value ) : string |
Quote a value for SQL |
|
quoteIdentifier ( string $identifier ) : string |
Quote identifier |
|
rewriteTable ( string $table ) : string |
Get rewritten table name |
|
rollback ( ) : boolean |
Rollback any changes during transaction |
|
select ( string $table, $options = [] ) : PDOStatement |
Select rows from a table |
|
setAlias ( string $alias, string $table ) |
Set alias of a table |
|
setBackReference ( string $table, string $name, string $key ) |
Set a back reference key for an association on a table |
|
setIdentifierDelimiter ( string | null $d ) |
Sets delimiter used when quoting identifiers. |
|
setPrimary ( string $table, string | array $key ) |
Set primary key of a table. |
|
setQueryCallback ( callable $callback ) |
Set the query callback |
|
setReference ( string $table, string $name, string $key ) |
Set a reference key for an association on a table |
|
setRequired ( string $table, string $column ) |
Set a column to be required for saving
Any primary key that is not auto-generated should be required
Compound primary keys are required by default |
|
setRewrite ( callable $rewrite ) |
Set table rewrite function
For example, it could add a prefix |
|
setSequence ( string $table, string $sequence ) |
Set primary sequence name of table |
|
table ( $name, integer | null $id = null ) : Result | lessql\Row | null |
Returns a result for table $name. |
|
update ( string $table, array $data, array $where = [], array $params = [] ) : null | PDOStatement |
Execute update query and return statement |
|