AbstractAdapter
in package
implements
AdapterInterface
Db abstract adapter class
Tags
Interfaces, Classes, Traits and Enums
- AdapterInterface
- Db adapter interface
Table of Contents
- $connection : mixed
- Database connection object/resource
- $error : mixed
- Error string/object/resource
- $listener : CallableObject
- Query listener object/resource
- $options : mixed
- Database connection options
- $profiler : Profiler
- Query profiler
- $result : mixed
- Result object/resource
- $statement : mixed
- Statement object/resource
- __construct() : mixed
- Constructor
- beginTransaction() : AbstractAdapter
- Begin a transaction
- bindParams() : AbstractAdapter
- Bind parameters to a prepared SQL query
- clearError() : AbstractAdapter
- Clear the error
- clearProfiler() : AbstractAdapter
- Clear query profiler
- commit() : AbstractAdapter
- Commit a transaction
- connect() : AbstractAdapter
- Connect to the database
- createSchema() : Schema
- Create Schema builder
- createSql() : Sql
- Create SQL builder
- disconnect() : void
- Disconnect from the database
- escape() : string
- Escape the value
- execute() : AbstractAdapter
- Execute a prepared SQL query
- fetch() : array<string|int, mixed>
- Fetch and return a row from the result
- fetchAll() : array<string|int, mixed>
- Fetch and return all rows from the result
- getConnection() : mixed
- Get the connection object/resource
- getError() : mixed
- Get the error
- getLastId() : int
- Return the last ID of the last query
- getListener() : CallableObject
- Get query listener
- getNumberOfRows() : int
- Return the number of rows from the last query
- getOptions() : array<string|int, mixed>
- Get database connection options
- getProfiler() : Profiler
- Get query profiler
- getResult() : mixed
- Get the result object/resource
- getStatement() : mixed
- Get the statement object/resource
- getTables() : array<string|int, mixed>
- Return the tables in the database
- getVersion() : string
- Return the database version
- hasError() : bool
- Determine whether or not there is an error
- hasOptions() : bool
- Has database connection options
- hasResult() : bool
- Determine whether or not a result resource exists
- hasStatement() : bool
- Determine whether or not a statement resource exists
- hasTable() : bool
- Return if the database has a table
- isConnected() : bool
- Determine whether or not connected
- listen() : mixed
- Add query listener to the adapter
- prepare() : AbstractAdapter
- Prepare a SQL query
- query() : AbstractAdapter
- Execute a SQL query directly
- rollback() : AbstractAdapter
- Rollback a transaction
- setError() : AbstractAdapter
- Set the error
- setOptions() : AdapterInterface
- Set database connection options
- setProfiler() : AbstractAdapter
- Set query profiler
- throwError() : void
- Throw a database error exception
Properties
$connection
Database connection object/resource
protected
mixed
$connection
= null
$error
Error string/object/resource
protected
mixed
$error
= null
$listener
Query listener object/resource
protected
CallableObject
$listener
= null
$options
Database connection options
protected
mixed
$options
= []
$profiler
Query profiler
protected
Profiler
$profiler
= null
$result
Result object/resource
protected
mixed
$result
= null
$statement
Statement object/resource
protected
mixed
$statement
= null
Methods
__construct()
Constructor
public
abstract __construct([array<string|int, mixed> $options = [] ]) : mixed
Instantiate the database adapter object
Parameters
- $options : array<string|int, mixed> = []
Return values
mixed —beginTransaction()
Begin a transaction
public
abstract beginTransaction() : AbstractAdapter
Return values
AbstractAdapter —bindParams()
Bind parameters to a prepared SQL query
public
abstract bindParams(array<string|int, mixed> $params) : AbstractAdapter
Parameters
- $params : array<string|int, mixed>
Return values
AbstractAdapter —clearError()
Clear the error
public
clearError() : AbstractAdapter
Return values
AbstractAdapter —clearProfiler()
Clear query profiler
public
clearProfiler() : AbstractAdapter
Return values
AbstractAdapter —commit()
Commit a transaction
public
abstract commit() : AbstractAdapter
Return values
AbstractAdapter —connect()
Connect to the database
public
abstract connect([array<string|int, mixed> $options = [] ]) : AbstractAdapter
Parameters
- $options : array<string|int, mixed> = []
Return values
AbstractAdapter —createSchema()
Create Schema builder
public
createSchema() : Schema
Return values
Schema —createSql()
Create SQL builder
public
createSql() : Sql
Return values
Sql —disconnect()
Disconnect from the database
public
disconnect() : void
Return values
void —escape()
Escape the value
public
abstract escape(string $value) : string
Parameters
- $value : string
Return values
string —execute()
Execute a prepared SQL query
public
abstract execute() : AbstractAdapter
Return values
AbstractAdapter —fetch()
Fetch and return a row from the result
public
abstract fetch() : array<string|int, mixed>
Return values
array<string|int, mixed> —fetchAll()
Fetch and return all rows from the result
public
abstract fetchAll() : array<string|int, mixed>
Return values
array<string|int, mixed> —getConnection()
Get the connection object/resource
public
getConnection() : mixed
Return values
mixed —getError()
Get the error
public
getError() : mixed
Return values
mixed —getLastId()
Return the last ID of the last query
public
abstract getLastId() : int
Return values
int —getListener()
Get query listener
public
getListener() : CallableObject
Return values
CallableObject —getNumberOfRows()
Return the number of rows from the last query
public
abstract getNumberOfRows() : int
Return values
int —getOptions()
Get database connection options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getProfiler()
Get query profiler
public
getProfiler() : Profiler
Return values
Profiler —getResult()
Get the result object/resource
public
getResult() : mixed
Return values
mixed —getStatement()
Get the statement object/resource
public
getStatement() : mixed
Return values
mixed —getTables()
Return the tables in the database
public
abstract getTables() : array<string|int, mixed>
Return values
array<string|int, mixed> —getVersion()
Return the database version
public
abstract getVersion() : string
Return values
string —hasError()
Determine whether or not there is an error
public
hasError() : bool
Return values
bool —hasOptions()
Has database connection options
public
abstract hasOptions() : bool
Return values
bool —hasResult()
Determine whether or not a result resource exists
public
hasResult() : bool
Return values
bool —hasStatement()
Determine whether or not a statement resource exists
public
hasStatement() : bool
Return values
bool —hasTable()
Return if the database has a table
public
hasTable(string $table) : bool
Parameters
- $table : string
Return values
bool —isConnected()
Determine whether or not connected
public
isConnected() : bool
Return values
bool —listen()
Add query listener to the adapter
public
listen(mixed $listener[, mixed $params = null ][, Profiler $profiler = null ]) : mixed
Parameters
- $listener : mixed
- $params : mixed = null
- $profiler : Profiler = null
Return values
mixed —prepare()
Prepare a SQL query
public
abstract prepare(string $sql) : AbstractAdapter
Parameters
- $sql : string
Return values
AbstractAdapter —query()
Execute a SQL query directly
public
abstract query(string $sql) : AbstractAdapter
Parameters
- $sql : string
Return values
AbstractAdapter —rollback()
Rollback a transaction
public
abstract rollback() : AbstractAdapter
Return values
AbstractAdapter —setError()
Set the error
public
setError(string $error) : AbstractAdapter
Parameters
- $error : string
Return values
AbstractAdapter —setOptions()
Set database connection options
public
abstract setOptions(array<string|int, mixed> $options) : AdapterInterface
Parameters
- $options : array<string|int, mixed>
Return values
AdapterInterface —setProfiler()
Set query profiler
public
setProfiler(Profiler $profiler) : AbstractAdapter
Parameters
- $profiler : Profiler
Return values
AbstractAdapter —throwError()
Throw a database error exception
public
throwError([string $error = null ]) : void
Parameters
- $error : string = null