class dibi

Static container class for Dibi connections.

Constants

AFFECTED_ROWS

IDENTIFIER

VERSION

version

REVISION

version

ASC

sorting order

DESC

sorting order

deprecated TEXT

deprecated BINARY

deprecated BOOL

deprecated INTEGER

deprecated FLOAT

deprecated DATE

deprecated DATETIME

deprecated TIME

deprecated FIELD_TEXT

deprecated FIELD_BINARY

deprecated FIELD_BOOL

deprecated FIELD_INTEGER

deprecated FIELD_FLOAT

deprecated FIELD_DATE

deprecated FIELD_DATETIME

deprecated FIELD_TIME

Properties

static string|null $sql
static float|null $elapsedTime
static float $totalTime
static int $numOfQueries
static string $defaultDriver

Methods

__construct()

Static class - cannot be instantiated.

static Connection
connect($config = [], $name = '0')

Creates a new Connection object and connects it to specified database.

static void
disconnect()

Disconnects from database (doesn't destroy Connection object).

static bool
isConnected()

Returns true when connection was established.

static Connection
getConnection($name = null)

Retrieve active connection.

static Connection
setConnection(Connection $connection)

Sets connection.

static 
activate($name) deprecated

No description

static Result|int
query($args)

Generates and executes SQL query - Monostate for Dibi\Connection::query().

static Result|int
nativeQuery($sql)

Executes the SQL query - Monostate for Dibi\Connection::nativeQuery().

static bool
test($args)

Generates and prints SQL query - Monostate for Dibi\Connection::test().

static DataSource
dataSource($args)

Generates and returns SQL query as DataSource - Monostate for Dibi\Connection::test().

static Row
fetch($args)

Executes SQL query and fetch result - Monostate for Dibi\Connection::query() & fetch().

static Row[]
fetchAll($args)

Executes SQL query and fetch results - Monostate for Dibi\Connection::query() & fetchAll().

static mixed
fetchSingle($args)

Executes SQL query and fetch first column - Monostate for Dibi\Connection::query() & fetchSingle().

static array
fetchPairs($args)

Executes SQL query and fetch pairs - Monostate for Dibi\Connection::query() & fetchPairs().

static int
getAffectedRows()

Gets the number of affected rows.

static 
affectedRows() deprecated

No description

static int
getInsertId($sequence = null)

Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

static 
insertId($sequence = null) deprecated

No description

static void
begin($savepoint = null)

Begins a transaction - Monostate for Dibi\Connection::begin().

static void
commit($savepoint = null)

Commits statements in a transaction - Monostate for Dibi\Connection::commit($savepoint = null).

static void
rollback($savepoint = null)

Rollback changes in a transaction - Monostate for Dibi\Connection::rollback().

static Database
getDatabaseInfo()

Gets a information about the current database - Monostate for Dibi\Connection::getDatabaseInfo().

static int
loadFile($file)

Import SQL dump from file - extreme fast!

static Fluent
command()

No description

static Fluent
select($args)

No description

static Fluent
update($table, $args)

No description

static Fluent
insert($table, $args)

No description

static Fluent
delete($table)

No description

static HashMap
getSubstitutes()

Returns substitution hashmap - Monostate for Dibi\Connection::getSubstitutes().

static string|null
dump($sql = null, $return = false)

Prints out a syntax highlighted version of the SQL command or Result.

stripMicroseconds($dt)

Strips microseconds part.

Details

at line 76
final __construct()

Static class - cannot be instantiated.

at line 92
static Connection connect($config = [], $name = '0')

Creates a new Connection object and connects it to specified database.

Parameters

$config
$name

Return Value

Connection

Exceptions

Exception

at line 102
static void disconnect()

Disconnects from database (doesn't destroy Connection object).

Return Value

void

at line 112
static bool isConnected()

Returns true when connection was established.

Return Value

bool

at line 124
static Connection getConnection($name = null)

Retrieve active connection.

Parameters

$name

Return Value

Connection

Exceptions

Exception

at line 147
static Connection setConnection(Connection $connection)

Sets connection.

Parameters

Connection $connection

Return Value

Connection

at line 156
static activate($name) deprecated

deprecated

No description

Parameters

$name

at line 172
static Result|int query($args)

Generates and executes SQL query - Monostate for Dibi\Connection::query().

Parameters

$args

Return Value

Result|int

result set or number of affected rows

Exceptions

Exception

at line 184
static Result|int nativeQuery($sql)

Executes the SQL query - Monostate for Dibi\Connection::nativeQuery().

Parameters

$sql

Return Value

Result|int

result set or number of affected rows

at line 195
static bool test($args)

Generates and prints SQL query - Monostate for Dibi\Connection::test().

Parameters

$args

Return Value

bool

at line 207
static DataSource dataSource($args)

Generates and returns SQL query as DataSource - Monostate for Dibi\Connection::test().

Parameters

$args

Return Value

DataSource

at line 220
static Row fetch($args)

Executes SQL query and fetch result - Monostate for Dibi\Connection::query() & fetch().

Parameters

$args

Return Value

Row

Exceptions

Exception

at line 233
static Row[] fetchAll($args)

Executes SQL query and fetch results - Monostate for Dibi\Connection::query() & fetchAll().

Parameters

$args

Return Value

Row[]

Exceptions

Exception

at line 246
static mixed fetchSingle($args)

Executes SQL query and fetch first column - Monostate for Dibi\Connection::query() & fetchSingle().

Parameters

$args

Return Value

mixed

Exceptions

Exception

at line 259
static array fetchPairs($args)

Executes SQL query and fetch pairs - Monostate for Dibi\Connection::query() & fetchPairs().

Parameters

$args

Return Value

array

Exceptions

Exception

at line 272
static int getAffectedRows()

Gets the number of affected rows.

Monostate for Dibi\Connection::getAffectedRows()

Return Value

int

number of rows

Exceptions

Exception

at line 281
static affectedRows() deprecated

deprecated

No description

at line 295
static int getInsertId($sequence = null)

Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

Monostate for Dibi\Connection::getInsertId()

Parameters

$sequence

Return Value

int

Exceptions

Exception

at line 304
static insertId($sequence = null) deprecated

deprecated

No description

Parameters

$sequence

at line 317
static void begin($savepoint = null)

Begins a transaction - Monostate for Dibi\Connection::begin().

Parameters

$savepoint

Return Value

void

Exceptions

Exception

at line 329
static void commit($savepoint = null)

Commits statements in a transaction - Monostate for Dibi\Connection::commit($savepoint = null).

Parameters

$savepoint

Return Value

void

Exceptions

Exception

at line 341
static void rollback($savepoint = null)

Rollback changes in a transaction - Monostate for Dibi\Connection::rollback().

Parameters

$savepoint

Return Value

void

Exceptions

Exception

at line 351
static Database getDatabaseInfo()

Gets a information about the current database - Monostate for Dibi\Connection::getDatabaseInfo().

Return Value

Database

at line 362
static int loadFile($file)

Import SQL dump from file - extreme fast!

Parameters

$file

Return Value

int

count of sql commands

at line 374
static Fluent command()

No description

Return Value

Fluent

at line 384
static Fluent select($args)

No description

Parameters

$args

Return Value

Fluent

at line 396
static Fluent update($table, $args)

No description

Parameters

$table
$args

Return Value

Fluent

at line 407
static Fluent insert($table, $args)

No description

Parameters

$table
$args

Return Value

Fluent

at line 417
static Fluent delete($table)

No description

Parameters

$table

Return Value

Fluent

at line 430
static HashMap getSubstitutes()

Returns substitution hashmap - Monostate for Dibi\Connection::getSubstitutes().

Return Value

HashMap

at line 445
static string|null dump($sql = null, $return = false)

Prints out a syntax highlighted version of the SQL command or Result.

Parameters

$sql
$return

Return Value

string|null

at line 456
static DateTime|DateTimeInterface stripMicroseconds($dt)

Strips microseconds part.

Parameters

$dt

Return Value

DateTime|DateTimeInterface

Traits

Better OOP experience.