Class DibiFluent
dibi SQL builder via fluent interfaces. EXPERIMENTAL!
- DibiObject
-
DibiFluent implements IDataSource, Traversable, IteratorAggregate, Countable
public
|
#
__construct(
DibiConnection
$connection
)
Parameters$connection DibiConnection |
public
DibiFluent
|
#
__call(
string
$clause,
array
$args
)
Appends new argument to the clause. Appends new argument to the clause. Parameters$clause string clause name$args array argumentsReturnsDibiFluent provides a fluent interface
|
public
DibiFluent
|
#
clause(
string
$clause,
$remove = false
)
Switch to a clause. Switch to a clause. Parameters$clause string clause name$remove ReturnsDibiFluent provides a fluent interface
|
public
DibiFluent
|
#
removeClause(
string
$clause
)
Removes a clause. Removes a clause. Parameters$clause string clause nameReturnsDibiFluent provides a fluent interface
|
public
DibiFluent
|
#
setFlag(
string
$flag,
bool
$value = true
)
Change a SQL flag. Change a SQL flag. Parameters$flag string flag name$value bool valueReturnsDibiFluent provides a fluent interface
|
final public
bool
|
#
getFlag(
string
$flag
)
Is a flag set? Is a flag set? Parameters$flag string flag name |
final public
string
|
#
getCommand(
)
Returns SQL command. Returns SQL command. |
final public
DibiConnection
|
#
getConnection(
)
Returns the dibi connection. Returns the dibi connection. |
public
DibiResult|int
|
#
execute(
mixed
$return = NULL
)
Generates and executes SQL query. Generates and executes SQL query. Parameters$return mixed what to return?ReturnsDibiResult|int result set object (if any)
Throws |
public
DibiRow|FALSE
|
#
fetch(
)
Generates, executes SQL query and fetches the single row. Generates, executes SQL query and fetches the single row. ReturnsDibiRow|FALSE array on success, FALSE if no next record
|
public
mixed
|
#
fetchSingle(
)
Like fetch(), but returns only first field. Like fetch(), but returns only first field. Returnsmixed value on success, FALSE if no next record
|
public
array
|
#
fetchAll(
int
$offset = NULL,
int
$limit = NULL
)
Fetches all records from table. Fetches all records from table. Parameters$offset int offset$limit int limit |
public
array
|
#
fetchAssoc(
string
$assoc
)
Fetches all records from table and returns associative tree. Fetches all records from table and returns associative tree. Parameters$assoc string associative descriptor |
public
array
|
#
fetchPairs(
string
$key = NULL,
string
$value = NULL
)
Fetches all records from table like $key ⇒ $value pairs. Fetches all records from table like $key ⇒ $value pairs. Parameters$key string associative key$value string value |
public
DibiResultIterator
|
#
getIterator(
int
$offset = NULL,
int
$limit = NULL
)
Required by the IteratorAggregate interface. Required by the IteratorAggregate interface. Parameters$offset int offset$limit int limitImplementation of |
public
bool
|
#
test(
string
$clause = NULL
)
Generates and prints SQL query or it's part. Generates and prints SQL query or it's part. Parameters$clause string clause name |
public
int
|
#
count(
)
Implementation of |
public
DibiDataSource
|
#
toDataSource(
)
|
final public
string
|
#
__toString(
)
Returns SQL query. Returns SQL query. |
protected
array
|
#
_export(
string
$clause = NULL,
$args = array (
)
)
Generates parameters for DibiTranslator. Generates parameters for DibiTranslator. Parameters$clause string clause name$args |
public
|
#
__clone(
)
|
Methods Inherited From DibiObject
getClass(), getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
REMOVE |
false # |
static
array
|
$masks | array ( 'SELECT' => array ( 0 => 'SELECT', 1 => 'DISTINCT', 2 => 'FROM', 3 => 'WHERE', 4 => 'GROUP BY', 5 => 'HAVING', 6 => 'ORDER BY', 7 => 'LIMIT', 8 => 'OFFSET', ), 'UPDATE' => array ( 0 => 'UPDATE', 1 => 'SET', 2 => 'WHERE', 3 => 'ORDER BY', 4 => 'LIMIT', ), 'INSERT' => array ( 0 => 'INSERT', 1 => 'INTO', 2 => 'VALUES', 3 => 'SELECT', ), 'DELETE' => array ( 0 => 'DELETE', 1 => 'FROM', 2 => 'USING', 3 => 'WHERE', 4 => 'ORDER BY', 5 => 'LIMIT', ), ) |
# |
static
array
|
$modifiers | array ( 'SELECT' => '%n', 'FROM' => '%n', 'IN' => '%in', 'VALUES' => '%l', 'SET' => '%a', 'WHERE' => '%and', 'HAVING' => '%and', 'ORDER BY' => '%by', 'GROUP BY' => '%by', ) |
default modifiers for arrays # |
static
array
|
$separators | array ( 'SELECT' => ',', 'FROM' => ',', 'WHERE' => 'AND', 'GROUP BY' => ',', 'HAVING' => 'AND', 'ORDER BY' => ',', 'LIMIT' => false, 'OFFSET' => false, 'SET' => ',', 'VALUES' => ',', 'INTO' => false, ) |
clauses separators # |
static
array
|
$clauseSwitches | array ( 'JOIN' => 'FROM', 'INNER JOIN' => 'FROM', 'LEFT JOIN' => 'FROM', 'RIGHT JOIN' => 'FROM', ) |
clauses # |