\RedBeanPHPDriver

Interface for database drivers.

The Driver API conforms to the ADODB pseudo standard for database drivers.

Summary

Methods
Constants
GetAll()
GetCol()
GetOne()
GetAssocRow()
GetRow()
Execute()
GetInsertID()
Affected_Rows()
GetCursor()
setDebugMode()
CommitTrans()
StartTrans()
FailTrans()
resetCounter()
getQueryCount()
setInitCode()
DatabaseServerVersion()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

GetAll()

GetAll(string  $sql, array  $bindings = array()) : array

Runs a query and fetches results as a multi dimensional array.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

array

GetCol()

GetCol(string  $sql, array  $bindings = array()) : array

Runs a query and fetches results as a column.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

array

GetOne()

GetOne(string  $sql, array  $bindings = array()) : mixed

Runs a query and returns results as a single cell.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

mixed

GetAssocRow()

GetAssocRow(string  $sql, array  $bindings = array()) : array

Runs a query and returns results as an associative array indexed by the first column.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

array

GetRow()

GetRow(string  $sql, array  $bindings = array()) : array

Runs a query and returns a flat array containing the values of one row.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

array

Execute()

Execute(string  $sql, array  $bindings = array()) : integer

Executes SQL code and allows key-value binding.

This function allows you to provide an array with values to bind to query parameters. For instance you can bind values to question marks in the query. Each value in the array corresponds to the question mark in the query that matches the position of the value in the array. You can also bind values using explicit keys, for instance array(":key"=>123) will bind the integer 123 to the key :key in the SQL. This method has no return value.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

integer —

Affected Rows

GetInsertID()

GetInsertID() : integer

Returns the latest insert ID if driver does support this feature.

Returns

integer

Affected_Rows()

Affected_Rows() : integer

Returns the number of rows affected by the most recent query if the currently selected driver driver supports this feature.

Returns

integer

GetCursor()

GetCursor(string  $sql, array  $bindings = array()) : \RedBeanPHP\Cursor

Returns a cursor-like object from the database.

Parameters

string $sql

SQL query to execute

array $bindings

list of values to bind to SQL snippet

Returns

\RedBeanPHP\Cursor

setDebugMode()

setDebugMode(  $tf,   $customLogger) : void

Toggles debug mode. In debug mode the driver will print all SQL to the screen together with some information about the results.

This method is for more fine-grained control. Normally you should use the facade to start the query debugger for you. The facade will manage the object wirings necessary to use the debugging functionality.

Usage (through facade):

R::debug( TRUE ); ...rest of program... R::debug( FALSE );

The example above illustrates how to use the RedBeanPHP query debugger through the facade.

Parameters

$tf
$customLogger

CommitTrans()

CommitTrans() : void

Commits a transaction.

StartTrans()

StartTrans() : void

Starts a transaction.

FailTrans()

FailTrans() : void

Rolls back a transaction.

resetCounter()

resetCounter() : self

Resets the internal Query Counter.

Returns

self

getQueryCount()

getQueryCount() : integer

Returns the number of SQL queries processed.

Returns

integer

setInitCode()

setInitCode(callable|NULL  $code) : void

Sets initialization code for connection.

Parameters

callable|NULL $code

code

DatabaseServerVersion()

DatabaseServerVersion() : string

Returns the version string from the database server.

Returns

string