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
|
|
|
*
|
2018-01-19 13:43:19 -05:00
|
|
|
* PHP version 7.1
|
2016-09-07 13:17:17 -04:00
|
|
|
*
|
|
|
|
* @package Query
|
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
2018-01-19 13:43:19 -05:00
|
|
|
* @copyright 2012 - 2018 Timothy J. Warren
|
2016-09-07 13:17:17 -04:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
* @link https://git.timshomepage.net/aviat4ion/Query
|
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
|
|
|
/**
|
2012-12-18 16:19:52 -05:00
|
|
|
* parent for database manipulation subclasses
|
2012-04-20 13:17:39 -04:00
|
|
|
*
|
|
|
|
* @package Query
|
2014-03-31 16:01:58 -04:00
|
|
|
* @subpackage Drivers
|
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
|
|
|
|
*
|
|
|
|
* @param string $sql
|
2012-04-19 11:42:50 -04:00
|
|
|
* @param int $limit
|
2014-04-22 14:02:54 -04:00
|
|
|
* @param int|bool $offset
|
2012-04-10 14:06:34 -04:00
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function limit($sql, $limit, $offset=FALSE);
|
2014-03-26 21:33:58 -04:00
|
|
|
|
2014-02-04 20:59:30 -05:00
|
|
|
/**
|
|
|
|
* Modify the query to get the query plan
|
|
|
|
*
|
|
|
|
* @param string $sql
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function explain($sql);
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the sql for random ordering
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function random();
|
2014-03-26 21:33:58 -04:00
|
|
|
|
2012-04-10 14:06:34 -04:00
|
|
|
/**
|
|
|
|
* Returns sql to list other databases
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function dbList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list tables
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function tableList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list system tables
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function systemTableList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list views
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function viewList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list triggers
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function triggerList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sql to list functions
|
|
|
|
*
|
2013-05-01 15:59:23 -04:00
|
|
|
* @return NULL
|
2012-04-10 14:06:34 -04:00
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function functionList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sql to list stored procedures
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function procedureList();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sql to list sequences
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function sequenceList();
|
2014-03-26 21:33:58 -04:00
|
|
|
|
2012-05-07 16:05:51 -04:00
|
|
|
/**
|
|
|
|
* Return sql to list database field types
|
|
|
|
*
|
2014-04-02 11:02:18 -04:00
|
|
|
* @return string|array
|
2012-05-07 16:05:51 -04:00
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function typeList();
|
2014-03-26 21:33:58 -04:00
|
|
|
|
2012-05-09 13:54:38 -04:00
|
|
|
/**
|
2014-03-26 21:33:58 -04:00
|
|
|
* Get information about the columns in the
|
2012-05-09 13:54:38 -04:00
|
|
|
* specified table
|
|
|
|
*
|
2014-02-18 15:18:01 -05:00
|
|
|
* @param string $table
|
2012-05-09 13:54:38 -04:00
|
|
|
* @return string
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function columnList($table);
|
2013-05-01 15:59:23 -04:00
|
|
|
|
2014-04-07 16:49:49 -04:00
|
|
|
/**
|
|
|
|
* Get the list of foreign keys for the current
|
|
|
|
* table
|
|
|
|
*
|
2014-04-15 16:15:08 -04:00
|
|
|
* @param string $table
|
2014-04-08 14:26:28 -04:00
|
|
|
* @return array
|
2014-04-07 16:49:49 -04:00
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function fkList($table);
|
2014-04-07 16:49:49 -04:00
|
|
|
|
2014-04-08 14:26:28 -04:00
|
|
|
/**
|
|
|
|
* Get the list of indexes for the current table
|
|
|
|
*
|
|
|
|
* @param string $table
|
|
|
|
* @return array
|
|
|
|
*/
|
2016-10-13 21:55:23 -04:00
|
|
|
public function indexList($table);
|
|
|
|
}
|