ICanBoogie/ActiveRecord master
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • ActiveRecord
      • Driver

Classes

  • ActiveRecordCacheBase
  • BelongsToRelation
  • Connection
  • ConnectionCollection
  • ConnectionOptions
  • DateTimePropertySupport
  • HasManyRelation
  • Helpers
  • Model
  • ModelCollection
  • Query
  • Relation
  • RelationCollection
  • RelationNotDefined
  • RuntimeActiveRecordCache
  • Schema
  • SchemaColumn
  • Statement
  • Table

Interfaces

  • ActiveRecordCache
  • Driver
  • Exception

Traits

  • CreatedAtProperty
  • DateProperty
  • DateTimeProperty
  • FinishAtProperty
  • FinishedAtProperty
  • StartAtProperty
  • StartedAtProperty
  • UpdatedAtProperty

Exceptions

  • ActiveRecordClassNotValid
  • ConnectionAlreadyEstablished
  • ConnectionNotDefined
  • ConnectionNotEstablished
  • DriverNotDefined
  • ModelAlreadyInstantiated
  • ModelNotDefined
  • RecordNotFound
  • ScopeNotDefined
  • StatementInvocationFailed
  • StatementNotValid
  • UnableToSetFetchMode

Functions

  • extract_charset_and_collate
  • get_model

Class Connection

A connection to a database.

PDO
Extended by ICanBoogie\ActiveRecord\Connection implements ICanBoogie\ActiveRecord\Driver uses ICanBoogie\Accessor\AccessorTrait (not available)
Namespace: ICanBoogie\ActiveRecord
Located at ActiveRecord/Connection.php

Methods summary

protected string
# get_id( )

Returns

string
protected string
# get_table_name_prefix( )

Returns

string
protected string
# get_charset( )

Returns

string
protected string
# get_collate( )

Returns

string
protected string
# get_timezone( )

Returns

string
protected string
# get_driver_name( )

Returns

string
protected ICanBoogie\ActiveRecord\Driver
# lazy_get_driver( )

Returns

ICanBoogie\ActiveRecord\Driver
public
# __construct( string $dsn, string $username = null, string $password = null, array $options = [] )

Establish a connection to a database.

Establish a connection to a database.

Custom options can be specified using the driver-specific connection options. See ICanBoogie\ActiveRecord\ConnectionOptions.

Parameters

$dsn
$username
$password
$options

Link

http://www.php.net/manual/en/pdo.construct.php
http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html

Overrides

PDO::__construct
public ICanBoogie\ActiveRecord\Statement
# __invoke( )

Alias to ICanBoogie\ActiveRecord\Connection::query().

Alias to ICanBoogie\ActiveRecord\Connection::query().

Returns

ICanBoogie\ActiveRecord\Statement
protected string
# resolve_driver_name( string $dsn )

Resolve the driver name from the DSN string.

Resolve the driver name from the DSN string.

Parameters

$dsn

Returns

string
protected string
# resolve_driver_class( string $driver_name )

Resolves driver class.

Resolves driver class.

Parameters

$driver_name

Returns

string

Throws

ICanBoogie\ActiveRecord\DriverNotDefined
protected ICanBoogie\ActiveRecord\Driver
# resolve_driver( string $driver_name )

Resolves a ICanBoogie\ActiveRecord\Driver implementation.

Resolves a ICanBoogie\ActiveRecord\Driver implementation.

Parameters

$driver_name

Returns

ICanBoogie\ActiveRecord\Driver
protected
# apply_options( array $options )

Applies options to the instance.

Applies options to the instance.

Parameters

$options
protected
# before_connection( array & $options )

Called before the connection.

Called before the connection.

May alter the options according to the driver.

Parameters

$options
protected
# after_connection( )
public ICanBoogie\ActiveRecord\Statement
# prepare( string $statement, array $options = [] )

Overrides the method to resolve the statement before it is prepared, then set its fetch mode and connection.

Overrides the method to resolve the statement before it is prepared, then set its fetch mode and connection.

Parameters

$statement
Query statement.
$options

Returns

ICanBoogie\ActiveRecord\Statement
The prepared statement.

Throws

ICanBoogie\ActiveRecord\StatementNotValid
if the statement cannot be prepared.

Overrides

PDO::prepare
public ICanBoogie\ActiveRecord\Statement
# query( $statement, array $args = [], array $options = [] )

Overrides the method in order to prepare (and resolve) the statement and execute it with the specified arguments and options.

Overrides the method in order to prepare (and resolve) the statement and execute it with the specified arguments and options.

Returns

ICanBoogie\ActiveRecord\Statement

Inheritdoc

Overrides

PDO::query
public
# exec( $statement )

Executes a statement.

Executes a statement.

The statement is resolved using the ICanBoogie\ActiveRecord\Connection::resolve_statement() method before it is executed.

The execution of the statement is wrapped in a try/catch block. PDOException are caught and ICanBoogie\ActiveRecord\StatementNotValid exception are thrown with additional information instead.

Using this method increments the queries_by_connection stat.

Throws

ICanBoogie\ActiveRecord\StatementNotValid
if the statement cannot be executed.

Inheritdoc

Overrides

PDO::exec
public string
# resolve_statement( string $statement )

Replaces placeholders with their value.

Replaces placeholders with their value.

The following placeholders are supported:

  • {prefix}: replaced by the $table_name_prefix property.
  • {charset}: replaced by the $charset property.
  • {collate}: replaced by the $collate property.

Parameters

$statement

Returns

string
The resolved statement.
public
# begin( )

Alias for the beginTransaction() method.

Alias for the beginTransaction() method.

See

\PDO::beginTransaction()
public string|array
# quote_string( string|array $string )

Parameters

$string

Returns

string|array

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::quote_string()
public string|array
# quote_identifier( string|array $identifier )

Parameters

$identifier

Returns

string|array

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::quote_identifier()
public mixed
# cast_value( mixed $value, string|null $type = null )

Parameters

$value
$type
One of SchemaColumn::TYPE_*.

Returns

mixed

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::cast_value()
public string
# render_column( ICanBoogie\ActiveRecord\SchemaColumn $column )

Parameters

$column

Returns

string

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::render_column()
public
# create_table( string $unprefixed_name, ICanBoogie\ActiveRecord\Schema $schema )

Parameters

$unprefixed_name
$unprefixed_table_name
$schema

Returns


$this

Throws

Exception

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::create_table()
public
# create_indexes( string $unprefixed_table_name, ICanBoogie\ActiveRecord\Schema $schema )

Parameters

$unprefixed_table_name
$schema

Returns


$this

Throws

Exception

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::create_indexes()
public
# create_unique_indexes( string $unprefixed_table_name, ICanBoogie\ActiveRecord\Schema $schema )

Parameters

$unprefixed_table_name
$schema

Returns


$this

Throws

Exception

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::create_unique_indexes()
public boolean
# table_exists( string $unprefixed_name )

Parameters

$unprefixed_name
The unprefixed name of the table.

Returns

boolean
true if the table exists, false otherwise.

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::table_exists()
public
# optimize( )

Codecoverageignore

Inheritdoc

Implementation of

ICanBoogie\ActiveRecord\Driver::optimize()

Methods inherited from PDO

__sleep(), __wakeup(), beginTransaction(), commit(), errorCode(), errorInfo(), getAttribute(), getAvailableDrivers(), inTransaction(), lastInsertId(), quote(), rollBack(), setAttribute()

Constants summary

Constants inherited from PDO

ATTR_AUTOCOMMIT, ATTR_CASE, ATTR_CLIENT_VERSION, ATTR_CONNECTION_STATUS, ATTR_CURSOR, ATTR_CURSOR_NAME, ATTR_DEFAULT_FETCH_MODE, ATTR_DRIVER_NAME, ATTR_EMULATE_PREPARES, ATTR_ERRMODE, ATTR_FETCH_CATALOG_NAMES, ATTR_FETCH_TABLE_NAMES, ATTR_MAX_COLUMN_LEN, ATTR_ORACLE_NULLS, ATTR_PERSISTENT, ATTR_PREFETCH, ATTR_SERVER_INFO, ATTR_SERVER_VERSION, ATTR_STATEMENT_CLASS, ATTR_STRINGIFY_FETCHES, ATTR_TIMEOUT, CASE_LOWER, CASE_NATURAL, CASE_UPPER, CURSOR_FWDONLY, CURSOR_SCROLL, ERRMODE_EXCEPTION, ERRMODE_SILENT, ERRMODE_WARNING, ERR_NONE, FETCH_ASSOC, FETCH_BOTH, FETCH_BOUND, FETCH_CLASS, FETCH_CLASSTYPE, FETCH_COLUMN, FETCH_FUNC, FETCH_GROUP, FETCH_INTO, FETCH_KEY_PAIR, FETCH_LAZY, FETCH_NAMED, FETCH_NUM, FETCH_OBJ, FETCH_ORI_ABS, FETCH_ORI_FIRST, FETCH_ORI_LAST, FETCH_ORI_NEXT, FETCH_ORI_PRIOR, FETCH_ORI_REL, FETCH_PROPS_LATE, FETCH_SERIALIZE, FETCH_UNIQUE, MYSQL_ATTR_COMPRESS, MYSQL_ATTR_DIRECT_QUERY, MYSQL_ATTR_FOUND_ROWS, MYSQL_ATTR_IGNORE_SPACE, MYSQL_ATTR_INIT_COMMAND, MYSQL_ATTR_LOCAL_INFILE, MYSQL_ATTR_MULTI_STATEMENTS, MYSQL_ATTR_SERVER_PUBLIC_KEY, MYSQL_ATTR_SSL_CA, MYSQL_ATTR_SSL_CAPATH, MYSQL_ATTR_SSL_CERT, MYSQL_ATTR_SSL_CIPHER, MYSQL_ATTR_SSL_KEY, MYSQL_ATTR_USE_BUFFERED_QUERY, NULL_EMPTY_STRING, NULL_NATURAL, NULL_TO_STRING, ODBC_ATTR_ASSUME_UTF8, ODBC_ATTR_USE_CURSOR_LIBRARY, ODBC_SQL_USE_DRIVER, ODBC_SQL_USE_IF_NEEDED, ODBC_SQL_USE_ODBC, PARAM_BOOL, PARAM_EVT_ALLOC, PARAM_EVT_EXEC_POST, PARAM_EVT_EXEC_PRE, PARAM_EVT_FETCH_POST, PARAM_EVT_FETCH_PRE, PARAM_EVT_FREE, PARAM_EVT_NORMALIZE, PARAM_INPUT_OUTPUT, PARAM_INT, PARAM_LOB, PARAM_NULL, PARAM_STMT, PARAM_STR

Properties summary

public integer $queries_count

The number of database queries and executions, used for statistics purpose.

The number of database queries and executions, used for statistics purpose.

# 0
public array[] $profiling

The number of micro seconds spent per request.

The number of micro seconds spent per request.

# []

Magic properties

public read-only string $charset

The character set used to communicate with the database. Defaults to "utf8".

public read-only string $collate

The collation of the character set. Defaults to "utf8_general_ci".

public read-only ICanBoogie\ActiveRecord\Driver $driver
public read-only string $driver_name

Name of the PDO driver.

public read-only string $id

Identifier of the database connection.

public read-only string $table_name_prefix

The prefix to prepend to every table name.

ICanBoogie/ActiveRecord master API documentation generated by ApiGen