55namespace imperazim \db ;
66
77/**
8- * Common base class for database drivers.
8+ * Common interface for database drivers.
99*
10- * Both Mysql and Sqlite3 extend this class , providing
10+ * Both Mysql and Sqlite3 implement this interface , providing
1111* a consistent API for CRUD operations.
1212*/
13- abstract class Database {
13+ interface Database {
1414
1515 /**
1616 * Creates tables if they do not exist.
1717 *
1818 * @param array $tables Associative array: table name => column definitions array
1919 */
20- abstract public function createTableIfNotExists (array $ tables ): void ;
20+ public function createTableIfNotExists (array $ tables ): void ;
2121
2222 /**
2323 * Inserts a row into a table.
2424 *
2525 * @param string $table Table name
2626 * @param array $data Column => value pairs
2727 */
28- abstract public function insert (string $ table , array $ data ): void ;
28+ public function insert (string $ table , array $ data ): void ;
2929
3030 /**
3131 * Selects rows from a table.
@@ -35,7 +35,7 @@ abstract public function insert(string $table, array $data): void;
3535 * @param array $filters Where conditions: [["col" => "val"], ...]
3636 * @return array Result rows
3737 */
38- abstract public function select (string $ table , string $ columns , array $ filters = []): array ;
38+ public function select (string $ table , string $ columns , array $ filters = []): array ;
3939
4040 /**
4141 * Updates rows in a table.
@@ -46,7 +46,7 @@ abstract public function select(string $table, string $columns, array $filters =
4646 * @param array $filters Where conditions
4747 * @return bool Whether any rows were affected
4848 */
49- abstract public function update (string $ table , string $ column , mixed $ value , array $ filters = []): bool ;
49+ public function update (string $ table , string $ column , mixed $ value , array $ filters = []): bool ;
5050
5151 /**
5252 * Deletes rows from a table.
@@ -55,7 +55,7 @@ abstract public function update(string $table, string $column, mixed $value, arr
5555 * @param array $filters Where conditions (required — no empty deletes)
5656 * @return int Number of deleted rows
5757 */
58- abstract public function delete (string $ table , array $ filters ): int ;
58+ public function delete (string $ table , array $ filters ): int ;
5959
6060 /**
6161 * Checks if a record exists in a table.
@@ -64,7 +64,7 @@ abstract public function delete(string $table, array $filters): int;
6464 * @param array $conditions Where conditions
6565 * @return bool Whether matching record exists
6666 */
67- abstract public function exists (string $ table , array $ conditions ): bool ;
67+ public function exists (string $ table , array $ conditions ): bool ;
6868
6969 /**
7070 * Executes a raw query with parameter binding.
@@ -73,10 +73,10 @@ abstract public function exists(string $table, array $conditions): bool;
7373 * @param array $params Bound parameter values
7474 * @return array Result rows (empty for non-SELECT)
7575 */
76- abstract public function query (string $ sql , array $ params = []): array ;
76+ public function query (string $ sql , array $ params = []): array ;
7777
7878 /**
7979 * Closes the database connection.
8080 */
81- abstract public function close (): void ;
81+ public function close (): void ;
8282}
0 commit comments