Documentation

AdapterInterface
in

Db adapter interface

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
6.5.0

Table of Contents

Methods

beginTransaction()  : AdapterInterface
Begin a transaction
bindParams()  : AdapterInterface
Bind parameters to a prepared SQL query
clearError()  : AdapterInterface
Clear the error
clearProfiler()  : AdapterInterface
Clear query profiler
commit()  : AdapterInterface
Commit a transaction
connect()  : AdapterInterface
Connect to the database
createSchema()  : Schema
Create Schema builder
createSql()  : Sql
Create SQL builder
delete()  : int
Directly execute a DELETE SQL query or prepared statement and return the results
disconnect()  : void
Disconnect from the database
escape()  : string
Escape the value
execute()  : AdapterInterface
Execute a prepared SQL query
executeSql()  : AdapterInterface
Execute a SQL query or prepared statement with params
fetch()  : 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
getNumberOfAffectedRows()  : int
Return the number of affected rows from the last query
getNumberOfRows()  : int
Return the number of rows from the last query
getOptions()  : array<string|int, mixed>
Get database connection options
getProfiler()  : Profiler|null
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
getTransactionDepth()  : int
Get transaction depth
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
insert()  : int
Directly execute an INSERT SQL query or prepared statement and return the results
isConnected()  : bool
Determine whether or not connected
isSuccess()  : bool
Check if transaction is success
isTransaction()  : bool
Check if adapter is in the middle of an open transaction
listen()  : mixed
Add query listener to the adapter
prepare()  : AdapterInterface
Prepare a SQL query.
query()  : AdapterInterface
Execute a SQL query directly
rollback()  : AdapterInterface
Rollback a transaction
select()  : array<string|int, mixed>
Directly execute a SELECT SQL query or prepared statement and return the results
setError()  : AdapterInterface
Set the error
setOptions()  : AdapterInterface
Set database connection options
setProfiler()  : AdapterInterface
Set query profiler
throwError()  : void
Throw a database error exception
transaction()  : void
Execute complete transaction with the DB adapter
update()  : int
Directly execute an UPDATE SQL query or prepared statement and return the results

Methods

delete()

Directly execute a DELETE SQL query or prepared statement and return the results

public delete(string|Sql $sql[, array<string|int, mixed> $params = [] ]) : int
Parameters
$sql : string|Sql
$params : array<string|int, mixed> = []
Return values
int

escape()

Escape the value

public escape([string|null $value = null ]) : string
Parameters
$value : string|null = null
Return values
string

executeSql()

Execute a SQL query or prepared statement with params

public executeSql(string|Sql $sql[, array<string|int, mixed> $params = [] ]) : AdapterInterface
Parameters
$sql : string|Sql
$params : array<string|int, mixed> = []
Return values
AdapterInterface

fetchAll()

Fetch and return all rows from the result

public fetchAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

getConnection()

Get the connection object/resource

public getConnection() : mixed

getLastId()

Return the last ID of the last query

public getLastId() : int
Return values
int

getNumberOfAffectedRows()

Return the number of affected rows from the last query

public getNumberOfAffectedRows() : int
Return values
int

getNumberOfRows()

Return the number of rows from the last query

public getNumberOfRows() : int
Return values
int

getOptions()

Get database connection options

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatement()

Get the statement object/resource

public getStatement() : mixed

getTables()

Return the tables in the database

public getTables() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTransactionDepth()

Get transaction depth

public getTransactionDepth() : int
Return values
int

getVersion()

Return the database version

public 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 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

insert()

Directly execute an INSERT SQL query or prepared statement and return the results

public insert(string|Sql $sql[, array<string|int, mixed> $params = [] ]) : int
Parameters
$sql : string|Sql
$params : array<string|int, mixed> = []
Return values
int

isConnected()

Determine whether or not connected

public isConnected() : bool
Return values
bool

isSuccess()

Check if transaction is success

public isSuccess() : bool
Return values
bool

isTransaction()

Check if adapter is in the middle of an open transaction

public isTransaction() : bool
Return values
bool

listen()

Add query listener to the adapter

public listen(mixed $listener) : mixed
Parameters
$listener : mixed

select()

Directly execute a SELECT SQL query or prepared statement and return the results

public select(string|Sql $sql[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$sql : string|Sql
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

transaction()

Execute complete transaction with the DB adapter

public transaction(mixed $callable[, mixed $params = null ]) : void
Parameters
$callable : mixed
$params : mixed = null
Tags
throws
Exception

update()

Directly execute an UPDATE SQL query or prepared statement and return the results

public update(string|Sql $sql[, array<string|int, mixed> $params = [] ]) : int
Parameters
$sql : string|Sql
$params : array<string|int, mixed> = []
Return values
int

        
On this page

Search results