class Fluent implements IDataSource

SQL builder via fluent interfaces.

Constants

REMOVE

Properties

static array $masks
static array $modifiers
static array $separators
static array $clauseSwitches

Methods

__construct(Connection $connection)

No description

__call($clause, $args)

Appends new argument to the clause.

clause($clause)

Switch to a clause.

removeClause($clause)

Removes a clause.

setFlag($flag, $value = true)

Change a SQL flag.

bool
getFlag($flag)

Is a flag set?

string
getCommand()

Returns SQL command.

getConnection()

No description

setupResult($method)

Adds Result setup.

Result|int
execute($return = null)

Generates and executes SQL query.

Row|false
fetch()

Generates, executes SQL query and fetches the single row.

mixed
fetchSingle()

Like fetch(), but returns only first field.

array
fetchAll($offset = null, $limit = null)

Fetches all records from table.

array
fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

array
fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

getIterator($offset = null, $limit = null)

Required by the IteratorAggregate interface.

bool
test($clause = null)

Generates and prints SQL query or it's part.

int
count()

No description

toDataSource()

No description

string
__toString()

Returns SQL query.

array
_export($clause = null, $args = [])

Generates parameters for Translator.

static string
_formatClause($s)

Format camelCase clause name to UPPER CASE.

__clone()

No description

select(mixed $field)

No description

distinct()

No description

from(mixed $table, mixed $args)

No description

where(mixed $cond)

No description

groupBy(mixed $field)

No description

having(mixed $cond)

No description

orderBy(mixed $field)

No description

limit(int $limit)

No description

offset(int $offset)

No description

join(mixed $table)

No description

leftJoin(mixed $table)

No description

innerJoin(mixed $table)

No description

rightJoin(mixed $table)

No description

outerJoin(mixed $table)

No description

as(mixed $field)

No description

on(mixed $cond)

No description

using(mixed $cond)

No description

Details

at line 108
__construct(Connection $connection)

No description

Parameters

Connection $connection

at line 124
Fluent __call($clause, $args)

Appends new argument to the clause.

Parameters

$clause
$args

Return Value

Fluent

at line 212
Fluent clause($clause)

Switch to a clause.

Parameters

$clause

Return Value

Fluent

at line 228
Fluent removeClause($clause)

Removes a clause.

Parameters

$clause

Return Value

Fluent

at line 241
Fluent setFlag($flag, $value = true)

Change a SQL flag.

Parameters

$flag
$value

Return Value

Fluent

at line 258
final bool getFlag($flag)

Is a flag set?

Parameters

$flag

Return Value

bool

at line 268
final string getCommand()

Returns SQL command.

Return Value

string

at line 277
final Connection getConnection()

No description

Return Value

Connection

at line 289
Fluent setupResult($method)

Adds Result setup.

Parameters

$method

Return Value

Fluent

at line 305
Result|int execute($return = null)

Generates and executes SQL query.

Parameters

$return

Return Value

Result|int

result set or number of affected rows

Exceptions

Exception

at line 323
Row|false fetch()

Generates, executes SQL query and fetches the single row.

Return Value

Row|false

at line 337
mixed fetchSingle()

Like fetch(), but returns only first field.

Return Value

mixed

value on success, false if no next record

at line 353
array fetchAll($offset = null, $limit = null)

Fetches all records from table.

Parameters

$offset
$limit

Return Value

array

at line 364
array fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

Parameters

$assoc

Return Value

array

at line 376
array fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

Parameters

$key
$value

Return Value

array

at line 388
ResultIterator getIterator($offset = null, $limit = null)

Required by the IteratorAggregate interface.

Parameters

$offset
$limit

Return Value

ResultIterator

at line 399
bool test($clause = null)

Generates and prints SQL query or it's part.

Parameters

$clause

Return Value

bool

at line 408
int count()

No description

Return Value

int

at line 435
DataSource toDataSource()

No description

Return Value

DataSource

at line 445
final string __toString()

Returns SQL query.

Return Value

string

at line 461
protected array _export($clause = null, $args = [])

Generates parameters for Translator.

Parameters

$clause
$args

Return Value

array

at line 501
static string _formatClause($s)

internal  
 

Format camelCase clause name to UPPER CASE.

Parameters

$s

Return Value

string

at line 511
__clone()

No description

at line 32
Fluent select(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 32
Fluent distinct()

No description

Return Value

Fluent

at line 32
Fluent from(mixed $table, mixed $args)

No description

Parameters

mixed $table
mixed $args

Return Value

Fluent

at line 32
Fluent where(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 32
Fluent groupBy(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 32
Fluent having(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 32
Fluent orderBy(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 32
Fluent limit(int $limit)

No description

Parameters

int $limit

Return Value

Fluent

at line 32
Fluent offset(int $offset)

No description

Parameters

int $offset

Return Value

Fluent

at line 32
Fluent join(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 32
Fluent leftJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 32
Fluent innerJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 32
Fluent rightJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 32
Fluent outerJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 32
Fluent as(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 32
Fluent on(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 32
Fluent using(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

Traits

Better OOP experience.