2012-04-10 14:06:34 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
2012-04-20 13:17:39 -04:00
|
|
|
* @author Timothy J. Warren
|
2015-11-10 20:58:32 -05:00
|
|
|
* @copyright Copyright (c) 2012 - 2015
|
2012-04-10 14:06:34 -04:00
|
|
|
* @link https://github.com/aviat4ion/Query
|
2012-04-20 13:17:39 -04:00
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
* @package Query
|
2012-04-10 14:06:34 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2015-07-16 16:56:13 -04:00
|
|
|
namespace Query;
|
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
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function db_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list tables
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function table_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list system tables
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function system_table_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list views
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function view_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns sql to list triggers
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function trigger_list();
|
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
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function function_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sql to list stored procedures
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function procedure_list();
|
2012-04-10 14:06:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return sql to list sequences
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function sequence_list();
|
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
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function type_list();
|
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
|
|
|
|
*/
|
2012-12-18 16:19:52 -05:00
|
|
|
public function column_list($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
|
|
|
*/
|
|
|
|
public function fk_list($table);
|
|
|
|
|
2014-04-08 14:26:28 -04:00
|
|
|
/**
|
|
|
|
* Get the list of indexes for the current table
|
|
|
|
*
|
|
|
|
* @param string $table
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function index_list($table);
|
|
|
|
|
2012-04-10 14:06:34 -04:00
|
|
|
}
|
2014-03-28 13:38:34 -04:00
|
|
|
// End of sql_interface.php
|