A super easy PHP Framework for web development!
https://github.com/exacti/phacil-framework
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.2 KiB
105 lines
2.2 KiB
3 years ago
|
<?php
|
||
|
|
||
|
/*
|
||
9 months ago
|
* Copyright © 2024 ExacTI Technology Solutions. All rights reserved.
|
||
3 years ago
|
* GPLv3 General License.
|
||
|
* https://exacti.com.br
|
||
|
* Phacil PHP Framework - https://github.com/exacti/phacil-framework
|
||
|
*/
|
||
|
|
||
9 months ago
|
namespace Phacil\Framework\Databases\Api;
|
||
3 years ago
|
|
||
9 months ago
|
/**
|
||
|
* @since 2.0.0
|
||
|
* @package Phacil\Framework\Databases\Api
|
||
|
* @api
|
||
|
*/
|
||
|
interface DriverInterface {
|
||
3 years ago
|
|
||
10 months ago
|
const LIST_DB_TYPE_ID = [
|
||
|
"NULL" => 0,
|
||
|
"MYSQL" => 1,
|
||
|
"MSSQL" => 2,
|
||
|
"ORACLE" => 3,
|
||
|
"POSTGRE" => 4,
|
||
|
"SQLLITE3" => 5,
|
||
|
];
|
||
|
|
||
3 years ago
|
/**
|
||
|
* Construct the connection.
|
||
|
*
|
||
|
* @param string $hostname
|
||
|
* @param string $username
|
||
|
* @param string $password
|
||
|
* @param string $database
|
||
|
* @param string $port Is optional
|
||
|
* @param string $charset Is optional
|
||
|
* @return void
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
public function __construct($hostname, $username, $password, $database);
|
||
|
|
||
|
/**
|
||
|
* Execute the SQL Query.
|
||
|
*
|
||
1 year ago
|
* @param string|null $sql
|
||
|
* @return \Phacil\Framework\Databases\Object\ResultInterface|\Phacil\Framework\MagiQL|bool
|
||
3 years ago
|
* @throws Exception
|
||
|
*/
|
||
1 year ago
|
public function query($sql);
|
||
3 years ago
|
|
||
|
/**
|
||
|
* Important escape to prevent SQL injection.
|
||
|
*
|
||
|
* @param string $value
|
||
|
* @return string
|
||
|
*/
|
||
|
public function escape($value);
|
||
|
|
||
|
/**
|
||
|
* Gets the number of rows affected by the last operation
|
||
|
*
|
||
|
* @return int */
|
||
|
public function countAffected();
|
||
|
|
||
|
/**
|
||
|
* Gets the ID of the last inserted row or sequence of values
|
||
|
*
|
||
|
* @return int|string */
|
||
|
public function getLastId();
|
||
|
|
||
|
/**
|
||
|
* Check is connected on database
|
||
|
* @return bool */
|
||
|
public function isConnected();
|
||
|
|
||
10 months ago
|
/**
|
||
|
* Execute a prepared statement with parameters
|
||
|
*
|
||
|
* @param string $sql SQL query with named placeholders
|
||
|
* @param array $params Associative array of parameters
|
||
|
* @return \Phacil\Framework\Databases\Object\ResultInterface|true
|
||
|
* @throws \Phacil\Framework\Exception
|
||
|
*/
|
||
|
public function execute($sql, array $params = []);
|
||
10 months ago
|
|
||
|
/**
|
||
|
* Return textual database driver type
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getDBType();
|
||
|
|
||
|
/**
|
||
|
* Return ID of database type
|
||
|
*
|
||
|
*
|
||
|
* @return int 1 = MySQL/MariaDB
|
||
|
* @return int 2 = MS SQL Server
|
||
|
* @return int 3 = Oracle Database
|
||
|
* @return int 4 = Postgre
|
||
|
* @return int 5 = SQLite3
|
||
|
* @return int 0 = NULL
|
||
|
*/
|
||
|
public function getDBTypeId();
|
||
3 years ago
|
}
|