* @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ namespace Query\Drivers\Firebird; use Query\Drivers\AbstractSQL; /** * Firebird Specific SQL */ class SQL extends AbstractSQL { /** * Limit clause * * @param string $sql * @param int $limit * @param int|bool $offset * @return string */ public function limit($sql, $limit, $offset=FALSE) { // Keep the current sql string safe for a moment $origSql = $sql; $sql = 'FIRST '. (int) $limit; if ($offset > 0) { $sql .= ' SKIP '. (int) $offset; } $sql = preg_replace("`SELECT`i", "SELECT {$sql}", $origSql); return $sql; } /** * Get the query plan for the sql query * * @param string $sql * @return string */ public function explain($sql) { return $sql; } /** * Random ordering keyword * * @return string */ public function random() { return NULL; } /** * Returns sql to list other databases * * @return NULL */ public function dbList() { return NULL; } /** * Returns sql to list tables * * @return string */ public function tableList() { return << d2.RDB\$DEPENDED_ON_NAME AND d1.RDB\$FIELD_NAME <> d2.RDB\$FIELD_NAME AND rc.RDB\$RELATION_NAME = '{$table}' -- table name SQL; } /** * Get the list of indexes for the current table * * @param string $table * @return array */ public function indexList($table) { return <<