Packages

  • dibi
    • drivers
    • nette
    • reflection
  • None
  • PHP

Classes

  • dibi
  • DibiConnection
  • DibiDataSource
  • DibiDateTime
  • DibiEvent
  • DibiFileLogger
  • DibiFirePhpLogger
  • DibiFluent
  • DibiObject
  • DibiResult
  • DibiResultIterator
  • DibiRow
  • DibiTranslator

Interfaces

  • IDataSource
  • IDibiDriver
  • IDibiReflector
  • IDibiResultDriver

Exceptions

  • DibiDriverException
  • DibiException
  • DibiNotImplementedException
  • DibiNotSupportedException
  • DibiPcreException
  • Overview
  • Package
  • Class
  • Tree

Class DibiFluent

dibi SQL builder via fluent interfaces. EXPERIMENTAL!

DibiObject
Extended by DibiFluent implements IDataSource
Package: dibi
Author: David Grudl
Located at libs/DibiFluent.php
Methods summary
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
arguments

Returns

DibiFluent
provides a fluent interface

Throws

LogicException
public DibiFluent
# clause( string $clause, $remove = FALSE )

Switch to a clause.

Switch to a clause.

Parameters

$clause
string
clause name
$remove

Returns

DibiFluent
provides a fluent interface
public DibiFluent
# removeClause( string $clause )

Removes a clause.

Removes a clause.

Parameters

$clause
string
clause name

Returns

DibiFluent
provides a fluent interface
public DibiFluent
# setFlag( string $flag, boolean $value = TRUE )

Change a SQL flag.

Change a SQL flag.

Parameters

$flag
string
flag name
$value
boolean
value

Returns

DibiFluent
provides a fluent interface
final public boolean
# getFlag( string $flag )

Is a flag set?

Is a flag set?

Parameters

$flag
string
flag name

Returns

boolean
final public string
# getCommand( )

Returns SQL command.

Returns SQL command.

Returns

string
final public DibiConnection
# getConnection( )

Returns the dibi connection.

Returns the dibi connection.

Returns

DibiConnection
public DibiResult|integer
# execute( mixed $return = NULL )

Generates and executes SQL query.

Generates and executes SQL query.

Parameters

$return
mixed
what to return?

Returns

DibiResult|integer
result set object (if any)

Throws

DibiException
public DibiRow|false
# fetch( )

Generates, executes SQL query and fetches the single row.

Generates, executes SQL query and fetches the single row.

Returns

DibiRow|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.

Returns

mixed
value on success, FALSE if no next record
public array
# fetchAll( integer $offset = NULL, integer $limit = NULL )

Fetches all records from table.

Fetches all records from table.

Parameters

$offset
integer
offset
$limit
integer
limit

Returns

array
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

Returns

array
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

Returns

array
public DibiResultIterator
# getIterator( integer $offset = NULL, integer $limit = NULL )

Required by the IteratorAggregate interface.

Required by the IteratorAggregate interface.

Parameters

$offset
integer
offset
$limit
integer
limit

Returns

DibiResultIterator

Implementation of

IteratorAggregate::getIterator
public boolean
# 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

Returns

boolean
public integer
# count( )

Returns

integer

Implementation of

Countable::count
public DibiDataSource
# toDataSource( )

Returns

DibiDataSource
final public string
# __toString( )

Returns SQL query.

Returns SQL query.

Returns

string
protected array
# _export( string $clause = NULL, $args = array() )

Generates parameters for DibiTranslator.

Generates parameters for DibiTranslator.

Parameters

$clause
string
clause name
$args

Returns

array
public
# __clone( )
Methods inherited from DibiObject
__callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getClass(), getReflection()
Constants summary
boolean REMOVE FALSE
#
Properties summary
public static array $masks array( 'SELECT' => array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET'), 'UPDATE' => array('UPDATE', 'SET', 'WHERE', 'ORDER BY', 'LIMIT'), 'INSERT' => array('INSERT', 'INTO', 'VALUES', 'SELECT'), 'DELETE' => array('DELETE', 'FROM', 'USING', 'WHERE', 'ORDER BY', 'LIMIT'), )
#
public 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

default modifiers for arrays

public static array $separators array( 'SELECT' => ',', 'FROM' => ',', 'WHERE' => 'AND', 'GROUP BY' => ',', 'HAVING' => 'AND', 'ORDER BY' => ',', 'LIMIT' => FALSE, 'OFFSET' => FALSE, 'SET' => ',', 'VALUES' => ',', 'INTO' => FALSE, )
#

clauses separators

clauses separators

public static array $clauseSwitches array( 'JOIN' => 'FROM', 'INNER JOIN' => 'FROM', 'LEFT JOIN' => 'FROM', 'RIGHT JOIN' => 'FROM', )
#

clauses

clauses

dibi API documentation API documentation generated by ApiGen 2.3.0