class Fluent implements IDataSource

SQL builder via fluent interfaces.

Constants

REMOVE

Properties

static $masks
static $modifiers

default modifiers for arrays

static $separators

clauses separators

static $clauseSwitches clauses

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|null $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|null $offset = null, int|null $limit = null)

Fetches all records from table.

array
fetchAssoc(string $assoc)

Fetches all records from table and returns associative tree.

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

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

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

Required by the IteratorAggregate interface.

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

Generates parameters for Translator.

static string
_formatClause(string $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

union(Fluent $fluent)

No description

unionAll(Fluent $fluent)

No description

as(mixed $field)

No description

on(mixed $cond)

No description

and(mixed $cond)

No description

or(mixed $cond)

No description

using(mixed $cond)

No description

update(mixed $cond)

No description

insert(mixed $cond)

No description

delete(mixed $cond)

No description

into(mixed $cond)

No description

values(mixed $cond)

No description

set(mixed $args)

No description

asc()

No description

desc()

No description

Details

at line 105
__construct(Connection $connection)

No description

Parameters

Connection $connection

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

Appends new argument to the clause.

Parameters

string $clause
array $args

Return Value

Fluent

at line 205
Fluent clause(string $clause)

Switch to a clause.

Parameters

string $clause

Return Value

Fluent

at line 219
Fluent removeClause(string $clause)

Removes a clause.

Parameters

string $clause

Return Value

Fluent

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

Change a SQL flag.

Parameters

string $flag
bool $value

Return Value

Fluent

at line 245
final bool getFlag(string $flag)

Is a flag set?

Parameters

string $flag

Return Value

bool

at line 254
final string|null getCommand()

Returns SQL command.

Return Value

string|null

at line 260
final Connection getConnection()

No description

Return Value

Connection

at line 269
Fluent setupResult(string $method)

Adds Result setup.

Parameters

string $method

Return Value

Fluent

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

Generates and executes SQL query.

Returns result set or number of affected rows

Parameters

string|null $return

Return Value

Result|int|null

Exceptions

Exception

at line 301
Row|array|null fetch()

Generates, executes SQL query and fetches the single row.

Return Value

Row|array|null

at line 313
mixed fetchSingle()

Like fetch(), but returns only first field.

Returns value on success, null if no next record

Return Value

mixed

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

Fetches all records from table.

Parameters

int|null $offset
int|null $limit

Return Value

array

at line 334
array fetchAssoc(string $assoc)

Fetches all records from table and returns associative tree.

Parameters

string $assoc

associative descriptor

Return Value

array

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

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

Parameters

string|null $key
string|null $value

Return Value

array

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

Required by the IteratorAggregate interface.

Parameters

int|null $offset
int|null $limit

Return Value

ResultIterator

at line 361
bool test(string|null $clause = null)

Generates and prints SQL query or it's part.

Parameters

string|null $clause

Return Value

bool

at line 367
int count()

No description

Return Value

int

at line 390
DataSource toDataSource()

No description

Return Value

DataSource

at line 399
final string __toString()

Returns SQL query.

Return Value

string

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

Generates parameters for Translator.

Parameters

string|null $clause
array $args

Return Value

array

at line 446
static string _formatClause(string $s)

internal  
 

Format camelCase clause name to UPPER CASE.

Parameters

string $s

Return Value

string

at line 457
__clone()

No description

at line 46
Fluent select(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 46
Fluent distinct()

No description

Return Value

Fluent

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

No description

Parameters

mixed $table
mixed $args

Return Value

Fluent

at line 46
Fluent where(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent groupBy(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 46
Fluent having(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent orderBy(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 46
Fluent limit(int $limit)

No description

Parameters

int $limit

Return Value

Fluent

at line 46
Fluent offset(int $offset)

No description

Parameters

int $offset

Return Value

Fluent

at line 46
Fluent join(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 46
Fluent leftJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 46
Fluent innerJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 46
Fluent rightJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 46
Fluent outerJoin(mixed $table)

No description

Parameters

mixed $table

Return Value

Fluent

at line 46
Fluent union(Fluent $fluent)

No description

Parameters

Fluent $fluent

Return Value

Fluent

at line 46
Fluent unionAll(Fluent $fluent)

No description

Parameters

Fluent $fluent

Return Value

Fluent

at line 46
Fluent as(mixed $field)

No description

Parameters

mixed $field

Return Value

Fluent

at line 46
Fluent on(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent and(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent or(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent using(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent update(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent insert(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent delete(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent into(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent values(mixed $cond)

No description

Parameters

mixed $cond

Return Value

Fluent

at line 46
Fluent set(mixed $args)

No description

Parameters

mixed $args

Return Value

Fluent

at line 46
Fluent asc()

No description

Return Value

Fluent

at line 46
Fluent desc()

No description

Return Value

Fluent