2009-06-12 08:44:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mysql specific SQL code generator.
|
|
|
|
*
|
2010-07-25 12:57:03 +00:00
|
|
|
* @package core
|
2012-01-27 00:10:45 +08:00
|
|
|
* @subpackage ddl_generator
|
2009-06-12 08:44:49 +00:00
|
|
|
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
|
|
|
|
* 2001-3001 Eloy Lafuente (stronk7) http://contiento.com
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2010-07-25 12:57:03 +00:00
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
require_once($CFG->libdir.'/ddl/sql_generator.php');
|
|
|
|
|
2006-08-16 17:43:55 +00:00
|
|
|
/// This class generate SQL code to be used against MySQL
|
|
|
|
/// It extends XMLDBgenerator so everything can be
|
2010-05-21 18:37:22 +00:00
|
|
|
/// overridden as needed to generate correct SQL.
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
class mysql_sql_generator extends sql_generator {
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2006-08-16 17:43:55 +00:00
|
|
|
/// Only set values that are different from the defaults present in XMLDBgenerator
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $quote_string = '`'; // String used to quote names
|
2006-08-15 11:30:32 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $default_for_char = ''; // To define the default to set for NOT NULLs CHARs without default (null=do nothing)
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $drop_default_value_required = true; //To specify if the generator must use some DEFAULT clause to drop defaults
|
|
|
|
public $drop_default_value = NULL; //The DEFAULT clause required to drop defaults
|
2006-09-25 18:22:06 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $primary_key_name = ''; //To force primary key names to one string (null=no force)
|
2006-08-15 09:14:31 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY'; // Template to drop PKs
|
2006-09-28 21:47:36 +00:00
|
|
|
// with automatic replace for TABLENAME and KEYNAME
|
2006-09-28 17:02:49 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME'; // Template to drop UKs
|
2006-09-28 21:47:36 +00:00
|
|
|
// with automatic replace for TABLENAME and KEYNAME
|
2006-09-28 17:02:49 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME'; // Template to drop FKs
|
2006-09-28 21:47:36 +00:00
|
|
|
// with automatic replace for TABLENAME and KEYNAME
|
2006-08-15 10:15:52 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields
|
|
|
|
public $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator
|
2006-08-16 17:43:55 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $add_after_clause = true; // Does the generator need to add the after clause for fields
|
2006-09-12 22:58:04 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $concat_character = null; //Characters to be used as concatenation operator. If not defined
|
2006-08-27 22:25:41 +00:00
|
|
|
//MySQL CONCAT function will be use
|
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $alter_column_sql = 'ALTER TABLE TABLENAME MODIFY COLUMN COLUMNSPECS'; //The SQL template to alter columns
|
2006-09-23 21:23:05 +00:00
|
|
|
|
2010-06-21 16:56:28 +00:00
|
|
|
public $drop_index_sql = 'ALTER TABLE TABLENAME DROP INDEX INDEXNAME'; //SQL sentence to drop one index
|
2010-05-21 18:37:22 +00:00
|
|
|
//TABLENAME, INDEXNAME are dynamically replaced
|
2006-09-26 23:15:20 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $rename_index_sql = null; //SQL sentence to rename one index (MySQL doesn't support this!)
|
2010-05-21 18:37:22 +00:00
|
|
|
//TABLENAME, OLDINDEXNAME, NEWINDEXNAME are dynamically replaced
|
2006-09-30 18:23:00 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
public $rename_key_sql = null; //SQL sentence to rename one key (MySQL doesn't support this!)
|
2010-05-21 18:37:22 +00:00
|
|
|
//TABLENAME, OLDKEYNAME, NEWKEYNAME are dynamically replaced
|
2006-09-30 19:43:16 +00:00
|
|
|
|
2008-11-21 21:40:50 +00:00
|
|
|
/**
|
|
|
|
* Reset a sequence to the id field of a table.
|
2009-08-31 14:23:40 +00:00
|
|
|
* @param string $table name of table or xmldb_table object
|
|
|
|
* @return array sql commands to execute
|
2008-11-21 21:40:50 +00:00
|
|
|
*/
|
2009-08-31 14:23:40 +00:00
|
|
|
public function getResetSequenceSQL($table) {
|
|
|
|
|
|
|
|
if ($table instanceof xmldb_table) {
|
2008-11-21 21:40:50 +00:00
|
|
|
$tablename = $table->getName();
|
2009-08-31 14:23:40 +00:00
|
|
|
} else {
|
|
|
|
$tablename = $table;
|
2008-11-21 21:40:50 +00:00
|
|
|
}
|
2009-08-31 14:23:40 +00:00
|
|
|
|
2008-11-21 21:40:50 +00:00
|
|
|
// From http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
|
|
|
|
$value = (int)$this->mdb->get_field_sql('SELECT MAX(id) FROM {'.$tablename.'}');
|
|
|
|
$value++;
|
2009-08-31 14:23:40 +00:00
|
|
|
return array("ALTER TABLE $this->prefix$tablename AUTO_INCREMENT = $value");
|
2008-11-21 21:40:50 +00:00
|
|
|
}
|
|
|
|
|
2010-08-18 16:47:00 +00:00
|
|
|
/**
|
|
|
|
* Given one correct xmldb_table, returns the SQL statements
|
|
|
|
* to create it (inside one array)
|
|
|
|
*/
|
|
|
|
public function getCreateTableSQL($xmldb_table) {
|
|
|
|
// first find out if want some special db engine
|
|
|
|
$engine = null;
|
|
|
|
if (method_exists($this->mdb, 'get_dbengine')) {
|
|
|
|
$engine = $this->mdb->get_dbengine();
|
|
|
|
}
|
|
|
|
|
|
|
|
$sqlarr = parent::getCreateTableSQL($xmldb_table);
|
|
|
|
|
|
|
|
if (!$engine) {
|
|
|
|
// we rely on database defaults
|
|
|
|
return $sqlarr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// let's inject the engine into SQL
|
|
|
|
foreach ($sqlarr as $i=>$sql) {
|
|
|
|
if (strpos($sql, 'CREATE TABLE ') === 0) {
|
|
|
|
$sqlarr[$i] .= " ENGINE = $engine";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sqlarr;
|
|
|
|
}
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
2008-06-07 14:57:47 +00:00
|
|
|
/**
|
|
|
|
* Given one correct xmldb_table, returns the SQL statements
|
|
|
|
* to create temporary table (inside one array)
|
|
|
|
*/
|
|
|
|
public function getCreateTempTableSQL($xmldb_table) {
|
2009-08-31 15:47:46 +00:00
|
|
|
$this->temptables->add_temptable($xmldb_table->getName());
|
2010-08-18 16:47:00 +00:00
|
|
|
$sqlarr = parent::getCreateTableSQL($xmldb_table); // we do not want the engine hack included in create table SQL
|
2009-09-09 09:44:39 +00:00
|
|
|
$sqlarr = preg_replace('/^CREATE TABLE (.*)/s', 'CREATE TEMPORARY TABLE $1', $sqlarr);
|
2008-06-07 14:57:47 +00:00
|
|
|
return $sqlarr;
|
|
|
|
}
|
|
|
|
|
2008-06-07 14:41:01 +00:00
|
|
|
/**
|
|
|
|
* Given one correct xmldb_table and the new name, returns the SQL statements
|
|
|
|
* to drop it (inside one array)
|
|
|
|
*/
|
2008-06-10 19:45:26 +00:00
|
|
|
public function getDropTempTableSQL($xmldb_table) {
|
2010-04-21 16:12:27 +00:00
|
|
|
$sqlarr = $this->getDropTableSQL($xmldb_table);
|
2008-06-07 14:41:01 +00:00
|
|
|
$sqlarr = preg_replace('/^DROP TABLE/', "DROP TEMPORARY TABLE", $sqlarr);
|
2009-08-31 15:47:46 +00:00
|
|
|
$this->temptables->delete_temptable($xmldb_table->getName());
|
2008-06-07 14:41:01 +00:00
|
|
|
return $sqlarr;
|
|
|
|
}
|
|
|
|
|
2006-08-15 09:14:31 +00:00
|
|
|
/**
|
2010-05-21 18:37:22 +00:00
|
|
|
* Given one XMLDB Type, length and decimals, returns the DB proper SQL type
|
2006-08-15 09:14:31 +00:00
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public function getTypeSQL($xmldb_type, $xmldb_length=null, $xmldb_decimals=null) {
|
2006-08-15 09:14:31 +00:00
|
|
|
|
|
|
|
switch ($xmldb_type) {
|
|
|
|
case XMLDB_TYPE_INTEGER: // From http://mysql.com/doc/refman/5.0/en/numeric-types.html!
|
|
|
|
if (empty($xmldb_length)) {
|
|
|
|
$xmldb_length = 10;
|
|
|
|
}
|
|
|
|
if ($xmldb_length > 9) {
|
|
|
|
$dbtype = 'BIGINT';
|
|
|
|
} else if ($xmldb_length > 6) {
|
|
|
|
$dbtype = 'INT';
|
|
|
|
} else if ($xmldb_length > 4) {
|
|
|
|
$dbtype = 'MEDIUMINT';
|
|
|
|
} else if ($xmldb_length > 2) {
|
|
|
|
$dbtype = 'SMALLINT';
|
|
|
|
} else {
|
2006-08-16 17:43:55 +00:00
|
|
|
$dbtype = 'TINYINT';
|
2006-08-15 09:14:31 +00:00
|
|
|
}
|
|
|
|
$dbtype .= '(' . $xmldb_length . ')';
|
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_NUMBER:
|
2006-08-15 11:30:32 +00:00
|
|
|
$dbtype = $this->number_type;
|
2006-08-15 09:14:31 +00:00
|
|
|
if (!empty($xmldb_length)) {
|
|
|
|
$dbtype .= '(' . $xmldb_length;
|
|
|
|
if (!empty($xmldb_decimals)) {
|
|
|
|
$dbtype .= ',' . $xmldb_decimals;
|
|
|
|
}
|
|
|
|
$dbtype .= ')';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_FLOAT:
|
2006-08-22 22:10:09 +00:00
|
|
|
$dbtype = 'DOUBLE';
|
|
|
|
if (!empty($xmldb_decimals)) {
|
|
|
|
if ($xmldb_decimals < 6) {
|
|
|
|
$dbtype = 'FLOAT';
|
|
|
|
}
|
|
|
|
}
|
2006-08-15 09:14:31 +00:00
|
|
|
if (!empty($xmldb_length)) {
|
|
|
|
$dbtype .= '(' . $xmldb_length;
|
|
|
|
if (!empty($xmldb_decimals)) {
|
|
|
|
$dbtype .= ',' . $xmldb_decimals;
|
2009-05-11 15:11:23 +00:00
|
|
|
} else {
|
|
|
|
$dbtype .= ', 0'; // In MySQL, if length is specified, decimals are mandatory for FLOATs
|
2006-08-15 09:14:31 +00:00
|
|
|
}
|
|
|
|
$dbtype .= ')';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_CHAR:
|
|
|
|
$dbtype = 'VARCHAR';
|
2006-08-16 22:23:39 +00:00
|
|
|
if (empty($xmldb_length)) {
|
2006-08-15 09:14:31 +00:00
|
|
|
$xmldb_length='255';
|
|
|
|
}
|
|
|
|
$dbtype .= '(' . $xmldb_length . ')';
|
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_TEXT:
|
2012-03-11 13:42:37 +01:00
|
|
|
$dbtype = 'LONGTEXT';
|
2006-08-15 09:14:31 +00:00
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_BINARY:
|
2012-03-11 13:42:37 +01:00
|
|
|
$dbtype = 'LONGBLOB';
|
2006-08-15 09:14:31 +00:00
|
|
|
break;
|
|
|
|
case XMLDB_TYPE_DATETIME:
|
|
|
|
$dbtype = 'DATETIME';
|
|
|
|
}
|
|
|
|
return $dbtype;
|
|
|
|
}
|
|
|
|
|
2006-09-25 18:22:06 +00:00
|
|
|
/**
|
2010-05-21 18:37:22 +00:00
|
|
|
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default
|
2006-09-25 18:22:06 +00:00
|
|
|
* (usually invoked from getModifyDefaultSQL()
|
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public function getCreateDefaultSQL($xmldb_table, $xmldb_field) {
|
2006-09-25 18:22:06 +00:00
|
|
|
/// Just a wrapper over the getAlterFieldSQL() function for MySQL that
|
|
|
|
/// is capable of handling defaults
|
|
|
|
return $this->getAlterFieldSQL($xmldb_table, $xmldb_field);
|
|
|
|
}
|
|
|
|
|
2006-10-01 22:44:39 +00:00
|
|
|
/**
|
2008-05-20 23:24:40 +00:00
|
|
|
* Given one correct xmldb_field and the new name, returns the SQL statements
|
2006-10-01 22:44:39 +00:00
|
|
|
* to rename it (inside one array)
|
2010-05-21 18:37:22 +00:00
|
|
|
* MySQL is pretty different from the standard to justify this overloading
|
2006-10-01 22:44:39 +00:00
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public function getRenameFieldSQL($xmldb_table, $xmldb_field, $newname) {
|
2006-10-01 22:44:39 +00:00
|
|
|
|
2007-03-15 20:02:17 +00:00
|
|
|
/// Need a clone of xmldb_field to perform the change leaving original unmodified
|
|
|
|
$xmldb_field_clone = clone($xmldb_field);
|
|
|
|
|
2006-10-01 22:44:39 +00:00
|
|
|
/// Change the name of the field to perform the change
|
2012-03-26 19:57:58 +02:00
|
|
|
$xmldb_field_clone->setName($newname);
|
2006-10-01 22:44:39 +00:00
|
|
|
|
2011-09-11 20:30:42 +02:00
|
|
|
$fieldsql = $this->getFieldSQL($xmldb_table, $xmldb_field_clone);
|
2008-05-15 21:40:00 +00:00
|
|
|
|
2012-03-26 19:57:58 +02:00
|
|
|
$sql = 'ALTER TABLE ' . $this->getTableName($xmldb_table) . ' CHANGE ' .
|
|
|
|
$xmldb_field->getName() . ' ' . $fieldsql;
|
2006-10-01 22:44:39 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
return array($sql);
|
2006-10-01 22:44:39 +00:00
|
|
|
}
|
|
|
|
|
2006-09-25 18:22:06 +00:00
|
|
|
/**
|
2010-05-21 18:37:22 +00:00
|
|
|
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default
|
2006-09-25 18:22:06 +00:00
|
|
|
* (usually invoked from getModifyDefaultSQL()
|
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public function getDropDefaultSQL($xmldb_table, $xmldb_field) {
|
2006-09-25 18:22:06 +00:00
|
|
|
/// Just a wrapper over the getAlterFieldSQL() function for MySQL that
|
|
|
|
/// is capable of handling defaults
|
|
|
|
return $this->getAlterFieldSQL($xmldb_table, $xmldb_field);
|
|
|
|
}
|
|
|
|
|
2006-08-15 09:14:31 +00:00
|
|
|
/**
|
2006-08-17 19:20:45 +00:00
|
|
|
* Returns the code (in array) needed to add one comment to the table
|
2006-08-15 09:14:31 +00:00
|
|
|
*/
|
2006-08-16 17:43:55 +00:00
|
|
|
function getCommentSQL ($xmldb_table) {
|
|
|
|
$comment = '';
|
2006-09-20 21:00:45 +00:00
|
|
|
|
2006-08-16 17:43:55 +00:00
|
|
|
if ($xmldb_table->getComment()) {
|
2006-09-30 12:13:07 +00:00
|
|
|
$comment .= 'ALTER TABLE ' . $this->getTableName($xmldb_table);
|
2008-05-15 21:40:00 +00:00
|
|
|
$comment .= " COMMENT='" . $this->addslashes(substr($xmldb_table->getComment(), 0, 60)) . "'";
|
2006-08-15 10:15:52 +00:00
|
|
|
}
|
2006-08-17 19:20:45 +00:00
|
|
|
return array($comment);
|
2006-08-15 09:14:31 +00:00
|
|
|
}
|
|
|
|
|
2007-04-08 22:59:54 +00:00
|
|
|
/**
|
|
|
|
* Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg)
|
|
|
|
* return if such name is currently in use (true) or no (false)
|
|
|
|
* (invoked from getNameForObject()
|
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public function isNameInUse($object_name, $type, $table_name) {
|
2007-04-09 00:11:22 +00:00
|
|
|
|
2007-04-08 22:59:54 +00:00
|
|
|
/// Calculate the real table name
|
2008-05-20 23:24:40 +00:00
|
|
|
$xmldb_table = new xmldb_table($table_name);
|
2007-04-08 22:59:54 +00:00
|
|
|
$tname = $this->getTableName($xmldb_table);
|
2008-05-15 21:40:00 +00:00
|
|
|
|
2007-04-08 22:59:54 +00:00
|
|
|
switch($type) {
|
|
|
|
case 'ix':
|
|
|
|
case 'uix':
|
2007-04-09 00:11:22 +00:00
|
|
|
/// First of all, check table exists
|
2008-05-15 21:40:00 +00:00
|
|
|
$metatables = $this->mdb->get_tables();
|
|
|
|
if (isset($metatables[$tname])) {
|
2007-04-09 00:11:22 +00:00
|
|
|
/// Fetch all the indexes in the table
|
2008-05-15 21:40:00 +00:00
|
|
|
if ($indexes = $this->mdb->get_indexes($tname)) {
|
2007-04-09 00:11:22 +00:00
|
|
|
/// Look for existing index in array
|
2008-05-15 21:40:00 +00:00
|
|
|
if (isset($indexes[$object_name])) {
|
2007-04-08 22:59:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false; //No name in use found
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-15 10:15:52 +00:00
|
|
|
/**
|
|
|
|
* Returns an array of reserved words (lowercase) for this DB
|
|
|
|
*/
|
2008-05-15 21:40:00 +00:00
|
|
|
public static function getReservedWords() {
|
2006-08-15 10:15:52 +00:00
|
|
|
/// This file contains the reserved words for MySQL databases
|
2009-03-02 18:53:59 +00:00
|
|
|
/// from http://dev.mysql.com/doc/refman/6.0/en/reserved-words.html
|
2006-08-15 10:15:52 +00:00
|
|
|
$reserved_words = array (
|
2009-03-02 18:53:59 +00:00
|
|
|
'accessible', 'add', 'all', 'alter', 'analyze', 'and', 'as', 'asc',
|
2006-08-15 10:15:52 +00:00
|
|
|
'asensitive', 'before', 'between', 'bigint', 'binary',
|
|
|
|
'blob', 'both', 'by', 'call', 'cascade', 'case', 'change',
|
|
|
|
'char', 'character', 'check', 'collate', 'column',
|
|
|
|
'condition', 'connection', 'constraint', 'continue',
|
|
|
|
'convert', 'create', 'cross', 'current_date', 'current_time',
|
|
|
|
'current_timestamp', 'current_user', 'cursor', 'database',
|
|
|
|
'databases', 'day_hour', 'day_microsecond',
|
|
|
|
'day_minute', 'day_second', 'dec', 'decimal', 'declare',
|
|
|
|
'default', 'delayed', 'delete', 'desc', 'describe',
|
|
|
|
'deterministic', 'distinct', 'distinctrow', 'div', 'double',
|
|
|
|
'drop', 'dual', 'each', 'else', 'elseif', 'enclosed', 'escaped',
|
|
|
|
'exists', 'exit', 'explain', 'false', 'fetch', 'float', 'float4',
|
|
|
|
'float8', 'for', 'force', 'foreign', 'from', 'fulltext', 'grant',
|
|
|
|
'group', 'having', 'high_priority', 'hour_microsecond',
|
|
|
|
'hour_minute', 'hour_second', 'if', 'ignore', 'in', 'index',
|
|
|
|
'infile', 'inner', 'inout', 'insensitive', 'insert', 'int', 'int1',
|
|
|
|
'int2', 'int3', 'int4', 'int8', 'integer', 'interval', 'into', 'is',
|
|
|
|
'iterate', 'join', 'key', 'keys', 'kill', 'leading', 'leave', 'left',
|
2009-03-02 18:53:59 +00:00
|
|
|
'like', 'limit', 'linear', 'lines', 'load', 'localtime', 'localtimestamp',
|
|
|
|
'lock', 'long', 'longblob', 'longtext', 'loop', 'low_priority', 'master_heartbeat_period',
|
|
|
|
'master_ssl_verify_server_cert', 'match', 'mediumblob', 'mediumint', 'mediumtext',
|
2006-08-15 10:15:52 +00:00
|
|
|
'middleint', 'minute_microsecond', 'minute_second',
|
|
|
|
'mod', 'modifies', 'natural', 'not', 'no_write_to_binlog',
|
|
|
|
'null', 'numeric', 'on', 'optimize', 'option', 'optionally',
|
2009-03-02 18:53:59 +00:00
|
|
|
'or', 'order', 'out', 'outer', 'outfile', 'overwrite', 'precision', 'primary',
|
|
|
|
'procedure', 'purge', 'raid0', 'range', 'read', 'read_only', 'read_write', 'reads', 'real',
|
2006-08-15 10:15:52 +00:00
|
|
|
'references', 'regexp', 'release', 'rename', 'repeat', 'replace',
|
|
|
|
'require', 'restrict', 'return', 'revoke', 'right', 'rlike', 'schema',
|
|
|
|
'schemas', 'second_microsecond', 'select', 'sensitive',
|
|
|
|
'separator', 'set', 'show', 'smallint', 'soname', 'spatial',
|
|
|
|
'specific', 'sql', 'sqlexception', 'sqlstate', 'sqlwarning',
|
|
|
|
'sql_big_result', 'sql_calc_found_rows', 'sql_small_result',
|
|
|
|
'ssl', 'starting', 'straight_join', 'table', 'terminated', 'then',
|
|
|
|
'tinyblob', 'tinyint', 'tinytext', 'to', 'trailing', 'trigger', 'true',
|
|
|
|
'undo', 'union', 'unique', 'unlock', 'unsigned', 'update',
|
|
|
|
'upgrade', 'usage', 'use', 'using', 'utc_date', 'utc_time',
|
|
|
|
'utc_timestamp', 'values', 'varbinary', 'varchar', 'varcharacter',
|
|
|
|
'varying', 'when', 'where', 'while', 'with', 'write', 'x509',
|
|
|
|
'xor', 'year_month', 'zerofill'
|
2006-09-20 21:00:45 +00:00
|
|
|
);
|
2006-08-15 10:15:52 +00:00
|
|
|
return $reserved_words;
|
|
|
|
}
|
2006-08-15 09:14:31 +00:00
|
|
|
}
|