Query/src/Drivers/SQLInterface.php

107 lines
2.0 KiB
PHP
Raw Normal View History

2016-10-12 22:12:25 -04:00
<?php declare(strict_types=1);
2012-04-10 14:06:34 -04:00
/**
* Query
*
2016-09-07 13:17:17 -04:00
* SQL Query Builder / Database Abstraction Layer
2012-04-10 14:06:34 -04:00
*
2022-09-29 11:33:08 -04:00
* PHP version 8.1
2016-09-07 13:17:17 -04:00
*
* @package Query
* @author Timothy J. Warren <tim@timshomepage.net>
2022-09-29 11:33:08 -04:00
* @copyright 2012 - 2022 Timothy J. Warren
2016-09-07 13:17:17 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2019-12-11 16:49:42 -05:00
* @link https://git.timshomepage.net/aviat/Query
2022-09-29 11:33:08 -04:00
* @version 4.0.0
2012-04-10 14:06:34 -04:00
*/
2016-09-07 17:39:19 -04:00
namespace Query\Drivers;
2014-04-02 17:08:50 -04:00
2012-04-10 14:06:34 -04:00
/**
* Interface for database-specific syntax subclasses
2012-04-10 14:06:34 -04:00
*/
2015-11-10 11:10:15 -05:00
interface SQLInterface {
2012-04-10 14:06:34 -04:00
/**
* Get database specific sql for limit clause
*/
public function limit(string $sql, int $limit, ?int $offset=NULL): string;
2014-02-04 20:59:30 -05:00
/**
* Modify the query to get the query plan
*/
2018-01-24 13:14:03 -05:00
public function explain(string $sql): string;
2012-04-10 14:06:34 -04:00
/**
* Get the sql for random ordering
*/
2018-01-24 13:14:03 -05:00
public function random(): string;
2012-04-10 14:06:34 -04:00
/**
* Returns sql to list other databases
*/
2018-01-24 13:14:03 -05:00
public function dbList(): string;
2012-04-10 14:06:34 -04:00
/**
* Returns sql to list tables
*/
2018-01-24 13:14:03 -05:00
public function tableList(): string;
2012-04-10 14:06:34 -04:00
/**
* Returns sql to list system tables
*/
public function systemTableList(): string|array;
2012-04-10 14:06:34 -04:00
/**
* Returns sql to list views
*/
2018-01-24 13:14:03 -05:00
public function viewList(): string;
2012-04-10 14:06:34 -04:00
/**
* Returns sql to list triggers
*
* @return string
*/
2018-01-24 13:14:03 -05:00
public function triggerList(): ?string;
2012-04-10 14:06:34 -04:00
/**
* Return sql to list functions
*
2018-01-24 13:14:03 -05:00
* @return string
2012-04-10 14:06:34 -04:00
*/
2018-01-24 13:14:03 -05:00
public function functionList(): ?string;
2012-04-10 14:06:34 -04:00
/**
* Return sql to list stored procedures
*
* @return string
*/
2018-01-24 13:14:03 -05:00
public function procedureList(): ?string;
2012-04-10 14:06:34 -04:00
/**
* Return sql to list sequences
*
* @return string
*/
2018-01-24 13:14:03 -05:00
public function sequenceList(): ?string;
/**
* Return sql to list database field types
*/
public function typeList(): string|array;
/**
* Get information about the columns in the
* specified table
*/
2018-01-24 13:14:03 -05:00
public function columnList(string $table): string;
/**
* Get the list of foreign keys for the current
* table
*/
2018-01-24 13:14:03 -05:00
public function fkList(string $table): string;
/**
* Get the list of indexes for the current table
*/
2018-01-24 13:14:03 -05:00
public function indexList(string $table): string;
2016-10-13 21:55:23 -04:00
}