<?php
namespace Incoviba\Common\Define;

use PDO;
use PDOStatement;
use PDOException;

interface Connection
{
    /**
     * @return Connection
     * @throws PDOException
     */
    public function connect(): Connection;

    /**
     * @param string $query
     * @return PDOStatement
     * @throws PDOException
     */
    public function query(string $query): PDOStatement;

    /**
     * @param string $query
     * @return PDOStatement
     * @throws PDOException
     */
    public function prepare(string $query): PDOStatement;

    /**
     * @param string $query
     * @param array|null $data
     * @return PDOStatement
     * @throws PDOException
     */
    public function execute(string $query, ?array $data = null): PDOStatement;

    /**
     * @return PDO
     * @throws PDOException
     */
    public function getPDO(): PDO;
    public function getQueryBuilder(): Query\Builder;
}
