IDbConnection
extends
ICloseable
in
Represents a connection to a database service.
Table of Contents
Methods
- close() : void
- Free, release or reset unmanaged resources.
- execute() : int|string
- Executes a statement and returns how many rows are affected.
- getLastInsertId() : int|string
- Returns the ID of the last inserted row.
- prepare() : IDbStatement
- Prepares a statement for execution and returns a database statement instance.
- query() : IDbResult
- Executes a statement and returns a database result instance.
Methods
close()
Free, release or reset unmanaged resources.
public
close() : void
execute()
Executes a statement and returns how many rows are affected.
public
execute(string $query) : int|string
Does not request results back from the database and thus should have better performance if the consumer doesn't care about them.
Parameters
- $query : string
-
SQL query to execute.
Return values
int|string —Number of rows affected by the query.
getLastInsertId()
Returns the ID of the last inserted row.
public
getLastInsertId() : int|string
Return values
int|string —Last inserted ID.
prepare()
Prepares a statement for execution and returns a database statement instance.
public
prepare(string $query) : IDbStatement
The statement should use question mark (?) parameters.
Parameters
- $query : string
-
SQL query to prepare.
Return values
IDbStatement —An instance of an implementation of IDbStatement.
query()
Executes a statement and returns a database result instance.
public
query(string $query) : IDbResult
Parameters
- $query : string
-
SQL query to execute.
Return values
IDbResult —An instance of an implementation of IDbResult