# Class Opencart\System\Library\DB

Class DB Adaptor

Located at system\library\db.php

Methods
`public` | `__construct( string $adaptor, string $hostname, string $username, string $password, string $database, string $port = '', string $ssl_key = '', string $ssl_cert = '', string $ssl_ca = '', )` Constructor Constructor | #
`public` | `query(string $sql): mixed` Query Query #### Parameters
$sql | SQL statement to be executed
| #
`public` | `escape(string $value): string` Escape Escape #### Parameters
$value | Value to be protected against SQL injections
#### Returns Returns escaped value | #
`public` | `countAffected(): int` countAffected Gets the total number of affected rows from the last query countAffected Gets the total number of affected rows from the last query #### Returns returns the total number of affected rows | #
`public` | `getLastId(): int` getLastId Get the last ID gets the primary key that was returned after creating a row in a table. getLastId Get the last ID gets the primary key that was returned after creating a row in a table. #### Returns Returns last ID | #
`public` | `isConnected(): bool` isConnected Checks if a DB connection is active. isConnected Checks if a DB connection is active. | #

OpenCart API API documentation generated by ApiGen dev-master