\RedBeanPHPAdapter

Adapter Interface.

Describes the API for a RedBeanPHP Database Adapter. This interface defines the API contract for a RedBeanPHP Database Adapter.

Summary

Methods
Constants
getSQL()
exec()
get()
getRow()
getCol()
getCell()
getAssoc()
getAssocRow()
getInsertID()
getAffectedRows()
getCursor()
getDatabase()
startTransaction()
commit()
rollback()
close()
setOption()
getDatabaseServerVersion()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getSQL()

getSQL() : string

Should returns a string containing the most recent SQL query that has been processed by the adapter.

Returns

string

exec()

exec(string  $sql, array  $bindings = array(), boolean  $noevent = FALSE) : integer

Executes an SQL Statement using an array of values to bind If $noevent is TRUE then this function will not signal its observers to notify about the SQL execution; this to prevent infinite recursion when using observers.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

boolean $noevent

no event firing

Returns

integer

get()

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

Executes an SQL Query and returns a resultset.

This method returns a multi dimensional resultset similar to getAll The values array can be used to bind values to the place holders in the SQL query.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

array

getRow()

getRow(string  $sql, array  $bindings = array()) : array|NULL

Executes an SQL Query and returns a resultset.

This method returns a single row (one array) resultset. The values array can be used to bind values to the place holders in the SQL query.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

array|NULL

getCol()

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

Executes an SQL Query and returns a resultset.

This method returns a single column (one array) resultset. The values array can be used to bind values to the place holders in the SQL query.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

array

getCell()

getCell(string  $sql, array  $bindings = array()) : string|NULL

Executes an SQL Query and returns a resultset.

This method returns a single cell, a scalar value as the resultset. The values array can be used to bind values to the place holders in the SQL query.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

string|NULL

getAssoc()

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

Executes the SQL query specified in $sql and indexes the row by the first column.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

array

getAssocRow()

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

Executes the SQL query specified in $sql and returns an associative array where the column names are the keys.

Parameters

string $sql

String containing SQL code for databaseQL

array $bindings

values to bind

Returns

array

getInsertID()

getInsertID() : integer

Returns the latest insert ID.

Returns

integer

getAffectedRows()

getAffectedRows() : integer

Returns the number of rows that have been affected by the last update statement.

Returns

integer

getCursor()

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

Returns a database agnostic Cursor object.

Parameters

string $sql

string containing SQL code for database

array $bindings

array of values to bind to parameters in query string

Returns

\RedBeanPHP\Cursor

getDatabase()

getDatabase() : \RedBeanPHP\Driver

Returns the original database resource. This is useful if you want to perform operations on the driver directly instead of working with the adapter. RedBean will only access the adapter and never to talk directly to the driver though.

Returns

\RedBeanPHP\Driver

startTransaction()

startTransaction() : void

This method is part of the RedBean Transaction Management mechanisms.

Starts a transaction.

commit()

commit() : void

This method is part of the RedBean Transaction Management mechanisms.

Commits the transaction.

rollback()

rollback() : void

This method is part of the RedBean Transaction Management mechanisms.

Rolls back the transaction.

close()

close() : void

Closes database connection.

setOption()

setOption(string  $optionKey, string  $optionValue) : boolean

Sets a driver specific option.

Using this method you can access driver-specific functions. If the selected option exists the value will be passed and this method will return boolean TRUE, otherwise it will return boolean FALSE.

Parameters

string $optionKey

option key

string $optionValue

option value

Returns

boolean

getDatabaseServerVersion()

getDatabaseServerVersion() : string

Returns the version string from the database server.

Returns

string