Methods

Returns a database cache object

cache(array $result, string $sql, mixed $as_object) : \Fuel\Core\Database_Cached

$db->cache($result, $sql);

Parameters

$result

array

$sql

string

$as_object

mixed

Returns

\Fuel\Core\Database_Cached

connect()

connect() 

Resolve a datatype

datatype(integer $type) : array

Parameters

$type

integer

Returns

array

Disconnect from the database

disconnect() 

Exceptions

\Exception when the mysql database is not disconnected properly

error_info()

error_info() 

Escape query for sql

escape(mixed $value) : string

Parameters

$value

mixed

value of string castable

Returns

stringescaped sql string

List table columns

list_columns(string $table, string $like) : array

Parameters

$table

string

table name

$like

string

column name pattern

Returns

arrayarray of column structure

List indexes

list_indexes($table, string $like) 

Parameters

$table

$like

string

Exceptions

\FuelException

List tables

list_tables(string $like) : array

Parameters

$like

string

pattern of table name

Returns

arrayarray of table names

Execute query

query(integer $type, string $sql, mixed $as_object) : mixed

Parameters

$type

integer

query type (\DB::SELECT, \DB::INSERT, etc.)

$sql

string

SQL string

$as_object

mixed

used when query type is SELECT

Exceptions

\Database_Exception

Returns

mixedwhen SELECT then return an iterator of results,
when INSERT then return a list of insert id and rows created,
in other case return the number of rows affected

set_charset()

set_charset($charset) 

Parameters

$charset

__construct()

__construct(string $name, array $config) 

Parameters

$name

string

$config

array

Select the database

_select_db(string $database) : void

Parameters

$database

string

Database

driver_commit()

driver_commit() 

driver_rollback()

driver_rollback() 

driver_start_transaction()

driver_start_transaction() 

Release savepoint of the transaction

release_savepoint(string $name) : boolean

Parameters

$name

string

name of the savepoint

Returns

booleantrue - savepoint was set successfully; false - failed to set savepoint;

Rollback savepoint of the transaction

rollback_savepoint(string $name) : boolean

Parameters

$name

string

name of the savepoint

Returns

booleantrue - savepoint was set successfully; false - failed to set savepoint;

Sets savepoint of the transaction

set_savepoint(string $name) : boolean

Parameters

$name

string

name of the savepoint

Returns

booleantrue - savepoint was set successfully; false - failed to set savepoint;

 Properties

 

<p>Which kind of DB is used</p>

$_db_type : string

 

<p>Raw server connection</p>

$_connection : \MySQLi

 

<p>Identifier for this connection within the PHP driver</p>

$_connection_id : string

 

<p>Database in use by each connection</p>

$_current_databases : array

 

<p>MySQL uses a backtick for identifiers</p>

$_identifier : string

 

<p>Use SET NAMES to set the character set</p>

$_set_names : bool