====== DbInterface ====== **Layer:** ''Core'' · **Source:** ''lib/core/DbInterface.php:20'' (lines 20–111) ---- interface DbInterface Describe the functionality that any database adapter will need. ======= Docblock Metadata ======= ^ Tag ^ Value ^ | ''@category'' | Core Class | | ''@author'' | M.Noermoehammad | | ''@license'' | MIT | | ''@version'' | 1.0 | | ''@since'' | Since Release 1.0 | ======= Inheritance ======= //No parent, interface or trait. This is a root type.// ======= Constants (0) ======= //None.// ======= Properties (0) ======= //None declared.// ======= Methods (12) ======= ^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''setDbConnection()'' | Set database connection. | 29 | | public | ''closeDbConnection()'' | Close database connection. | 34 | | public | ''dbQuery()'' | Execute an SQL query. | 43 | | public | ''dbInsert()'' | Insert a new record. | 53 | | public | ''dbReplace()'' | Insert ... On Duplicate Key Update. | 65 | | public | ''dbUpdate()'' | Update an existing record. | 75 | | public | ''dbDelete()'' | Delete a record. | 85 | | public | ''dbLastInsertId()'' | Get the last inserted ID. | 90 | | public | ''dbTransaction()'' | Start a transaction. | 95 | | public | ''dbCommit()'' | Commit the current transaction. | 100 | | public | ''dbRollBack()'' | Rollback the current transaction. | 105 | | public | ''isConnected()'' | Check if a database connection is active. | 110 | ======== setDbConnection() ======== public function setDbConnection(array $config, array $options = []): void //line 29// Set database connection. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$config'' | ''array'' | //required// | //none// | | ''$options'' | ''array'' | ''[]'' | //none// | **Returns:** ''void'' — void ======== closeDbConnection() ======== public function closeDbConnection(): void //line 34// Close database connection. //Takes no parameters.// **Returns:** ''void'' ======== dbQuery() ======== public function dbQuery(string $sql, array $parameters = []) //line 43// Execute an SQL query. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$sql'' | ''string'' | //required// | //none// | | ''$parameters'' | ''array'' | ''[]'' | //none// | **Returns:** ''(none declared)'' — \PDOStatement|false ======== dbInsert() ======== public function dbInsert(string $tablename, array $params): bool //line 53// Insert a new record. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$tablename'' | ''string'' | //required// | //none// | | ''$params'' | ''array'' | //required// | //none// | **Returns:** ''bool'' — boolean ======== dbReplace() ======== public function dbReplace(string $tablename, array $params, array $updateParams): bool //line 65// Insert ... On Duplicate Key Update. Replace statement to Insert or Update row. The correct way to do REPLACE INTO ^ Parameter ^ Type ^ Default ^ Description ^ | ''$tablename'' | ''string'' | //required// | //none// | | ''$params'' | ''array'' | //required// | //none// | | ''$updateParams'' | ''array'' | //required// | //none// | **Returns:** ''bool'' — boolean ======== dbUpdate() ======== public function dbUpdate(string $tablename, array $params, array $where): int //line 75// Update an existing record. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$tablename'' | ''string'' | //required// | //none// | | ''$params'' | ''array'' | //required// | //none// | | ''$where'' | ''array'' | //required// | //none// | **Returns:** ''int'' — int ======== dbDelete() ======== public function dbDelete(string $tablename, array $where, ?int $limit = null): int //line 85// Delete a record. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$tablename'' | ''string'' | //required// | //none// | | ''$where'' | ''array'' | //required// | //none// | | ''$limit'' | ''?int'' | ''null'' | default null | **Returns:** ''int'' — int ======== dbLastInsertId() ======== public function dbLastInsertId(): string //line 90// Get the last inserted ID. //Takes no parameters.// **Returns:** ''string'' ======== dbTransaction() ======== public function dbTransaction(): bool //line 95// Start a transaction. //Takes no parameters.// **Returns:** ''bool'' ======== dbCommit() ======== public function dbCommit(): bool //line 100// Commit the current transaction. //Takes no parameters.// **Returns:** ''bool'' ======== dbRollBack() ======== public function dbRollBack(): bool //line 105// Rollback the current transaction. //Takes no parameters.// **Returns:** ''bool'' ======== isConnected() ======== public function isConnected(): bool //line 110// Check if a database connection is active. //Takes no parameters.// **Returns:** ''bool'' ---- //This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//