class Fluent implements IDataSource

SQL builder via fluent interfaces.

Traits

Better OOP experience.

Constants

REMOVE

Properties

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

Methods

__construct(Connection $connection)

No description

__call(string $clause, array $args)

Appends new argument to the clause.

clause(string $clause)

Switch to a clause.

removeClause(string $clause)

Removes a clause.

setFlag(string $flag, bool $value = true)

Change a SQL flag.

bool
getFlag(string $flag)

Is a flag set?

string|null
getCommand()

Returns SQL command.

getConnection()

No description

setupResult(string $method)

Adds Result setup.

Result|int|null
execute(string $return = null)

Generates and executes SQL query.

Row|array|null
fetch()

Generates, executes SQL query and fetches the single row.

mixed
fetchSingle()

Like fetch(), but returns only first field.

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

Fetches all records from table.

array
fetchAssoc(string $assoc)

Fetches all records from table and returns associative tree.

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

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

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

Required by the IteratorAggregate interface.

bool
test(string $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(string $clause = null, array $args = [])

Generates parameters for Translator.

static string
_formatClause(string $s)

Format camelCase clause name to UPPER CASE.

__clone()

No description

Fluent
select()

No description

Fluent
distinct()

No description

Fluent
from($table)

No description

Fluent
where()

No description

Fluent
groupBy()

No description

Fluent
having()

No description

Fluent
orderBy()

No description

Fluent
limit(int $limit)

No description

Fluent
offset(int $offset)

No description

Fluent
join()

No description

Fluent
leftJoin()

No description

Fluent
innerJoin()

No description

Fluent
rightJoin()

No description

Fluent
outerJoin()

No description

Fluent
as()

No description

Fluent
on()

No description

Fluent
and()

No description

Fluent
or()

No description

Fluent
using()

No description

Fluent
asc()

No description

Fluent
desc()

No description

Details

at line 111
__construct(Connection $connection)

Parameters

Connection $connection

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

Appends new argument to the clause.

Parameters

string $clause
array $args

Return Value

Fluent

at line 210
Fluent clause(string $clause)

Switch to a clause.

Parameters

string $clause

Return Value

Fluent

at line 224
Fluent removeClause(string $clause)

Removes a clause.

Parameters

string $clause

Return Value

Fluent

at line 234
Fluent setFlag(string $flag, bool $value = true)

Change a SQL flag.

Parameters

string $flag
bool $value

Return Value

Fluent

at line 249
final bool getFlag(string $flag)

Is a flag set?

Parameters

string $flag

Return Value

bool

at line 258
final string|null getCommand()

Returns SQL command.

Return Value

string|null

at line 264
final Connection getConnection()

Return Value

Connection

at line 273
Fluent setupResult(string $method)

Adds Result setup.

Parameters

string $method

Return Value

Fluent

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

Generates and executes SQL query.

Parameters

string $return

Return Value

Result|int|null result set or number of affected rows

Exceptions

Exception

at line 306
Row|array|null fetch()

Generates, executes SQL query and fetches the single row.

Return Value

Row|array|null

at line 320
mixed fetchSingle()

Like fetch(), but returns only first field.

Return Value

mixed value on success, null if no next record

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

Fetches all records from table.

Parameters

int $offset
int $limit

Return Value

array

at line 343
array fetchAssoc(string $assoc)

Fetches all records from table and returns associative tree.

Parameters

string $assoc associative descriptor

Return Value

array

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

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

Parameters

string $key
string $value

Return Value

array

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

Required by the IteratorAggregate interface.

Parameters

int $offset
int $limit

Return Value

ResultIterator

at line 370
bool test(string $clause = null)

Generates and prints SQL query or it's part.

Parameters

string $clause

Return Value

bool

at line 376
int count()

Return Value

int

at line 398
DataSource toDataSource()

Return Value

DataSource

at line 407
final string __toString()

Returns SQL query.

Return Value

string

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

Generates parameters for Translator.

Parameters

string $clause
array $args

Return Value

array

at line 459
static string _formatClause(string $s)

Format camelCase clause name to UPPER CASE.

Parameters

string $s

Return Value

string

at line 469
__clone()

at line 38
Fluent select()

Return Value

Fluent

at line 38
Fluent distinct()

Return Value

Fluent

at line 38
Fluent from($table)

Parameters

$table

Return Value

Fluent

at line 38
Fluent where()

Return Value

Fluent

at line 38
Fluent groupBy()

Return Value

Fluent

at line 38
Fluent having()

Return Value

Fluent

at line 38
Fluent orderBy()

Return Value

Fluent

at line 38
Fluent limit(int $limit)

Parameters

int $limit

Return Value

Fluent

at line 38
Fluent offset(int $offset)

Parameters

int $offset

Return Value

Fluent

at line 38
Fluent join()

Return Value

Fluent

at line 38
Fluent leftJoin()

Return Value

Fluent

at line 38
Fluent innerJoin()

Return Value

Fluent

at line 38
Fluent rightJoin()

Return Value

Fluent

at line 38
Fluent outerJoin()

Return Value

Fluent

at line 38
Fluent as()

Return Value

Fluent

at line 38
Fluent on()

Return Value

Fluent

at line 38
Fluent and()

Return Value

Fluent

at line 38
Fluent or()

Return Value

Fluent

at line 38
Fluent using()

Return Value

Fluent

at line 38
Fluent asc()

Return Value

Fluent

at line 38
Fluent desc()

Return Value

Fluent