Query/src/Drivers/SQLInterface.php

101 lines
1.9 KiB
PHP
Raw Permalink 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
2023-01-20 11:30:51 -05:00
* @author Timothy J. Warren <tim@timshome.page>
* @copyright 2012 - 2023 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
2023-03-17 16:34:21 -04:00
* @version 4.1.0
2012-04-10 14:06:34 -04:00
*/
2023-03-17 15:18:33 -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
*/
2023-03-17 15:18:33 -04: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
*/
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
public function functionList(): ?string;
2012-04-10 14:06:34 -04:00
/**
* Return sql to list stored procedures
*/
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
*/
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;
2023-03-17 15:18:33 -04:00
}