123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- /*
- * Part of Shuzanne - An extensible sequel to an open-source imageboard.
- *
- * @package Shuzanne
- * @author MisleadingName, Shuzanne Contributors
- * @license MPL v2.0
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
- */
- namespace app\Interfaces;
- use PDO;
- interface IDatabase
- {
- /**
- * Closes the database connection.
- */
- public function CloseConnection(): void;
- /**
- * Binds a single parameter to the query.
- */
- public function Bind(string $param, mixed $value): void;
- /**
- * Binds multiple parameters to the query.
- */
- public function BindMore(array $params): void;
- /**
- * Executes a SQL query.
- *
- * @param string $query
- * @param array|null $params
- * @param int $fetchMode
- * @return mixed
- */
- public function Query(string $query, ?array $params = null, int $fetchMode = PDO::FETCH_ASSOC): mixed;
- /**
- * Executes a SQL query and returns the row count.
- *
- * @param string $query
- * @param array|null $params
- * @param int $fetchMode
- * @return int
- */
- public function QueryRowCount(string $query, ?array $params = null, int $fetchMode = PDO::FETCH_ASSOC): int;
- /**
- * Returns the ID of the last inserted row.
- */
- public function LastInsertId(): string;
- /**
- * Begins a transaction.
- */
- public function BeginTransaction(): bool;
- /**
- * Commits a transaction.
- */
- public function ExecuteTransaction(): bool;
- /**
- * Rolls back a transaction.
- */
- public function Rollback(): bool;
- /**
- * Returns a single column from a result set.
- *
- * @param string $query
- * @param array|null $params
- * @return array
- */
- public function Column(string $query, ?array $params = null): array;
- /**
- * Returns a single row from a result set.
- *
- * @param string $query
- * @param array|null $params
- * @param int $fetchMode
- * @return array
- */
- public function Row(string $query, ?array $params = null, int $fetchMode = PDO::FETCH_ASSOC): array;
- /**
- * Returns a single value from a result set.
- *
- * @param string $query
- * @param array|null $params
- * @return mixed
- */
- public function Single(string $query, ?array $params = null): mixed;
- }
|