MDL-32003 fix phpdocs in DDL layer

This commit is contained in:
Petr Skoda
2012-06-17 22:56:28 +02:00
parent 00902cd974
commit 5a070f0477
8 changed files with 924 additions and 587 deletions
+179 -88
View File
@@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,12 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Oracle specific SQL code generator.
*
* @package core
* @subpackage ddl_generator
* @package core_ddl
* @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
@@ -30,37 +27,61 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/ddl/sql_generator.php');
/// This class generate SQL code to be used against Oracle
/// It extends XMLDBgenerator so everything can be
/// overridden as needed to generate correct SQL.
/**
* This class generate SQL code to be used against Oracle
* It extends XMLDBgenerator so everything can be
* overridden as needed to generate correct SQL.
*
* @package core_ddl
* @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
*/
class oracle_sql_generator extends sql_generator {
/// Only set values that are different from the defaults present in XMLDBgenerator
// Only set values that are different from the defaults present in XMLDBgenerator
public $statement_end = "\n/"; // String to be automatically added at the end of each statement
// Using "/" because the standard ";" isn't good for stored procedures (triggers)
/**
* @var string To be automatically added at the end of each statement.
* note: Using "/" because the standard ";" isn't good for stored procedures (triggers)
*/
public $statement_end = "\n/";
public $number_type = 'NUMBER'; // Proper type for NUMBER(x) in this DB
/** @var string Proper type for NUMBER(x) in this DB. */
public $number_type = 'NUMBER';
public $default_for_char = ' '; // To define the default to set for NOT NULLs CHARs without default (null=do nothing)
// Using this whitespace here because Oracle doesn't distinguish empty and null! :-(
/**
* @var string To define the default to set for NOT NULLs CHARs without default (null=do nothing).
* note: Using this whitespace here because Oracle doesn't distinguish empty and null! :-(
*/
public $default_for_char = ' ';
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
/** @var bool To specify if the generator must use some DEFAULT clause to drop defaults.*/
public $drop_default_value_required = true;
public $default_after_null = false; //To decide if the default clause of each field must go after the null clause
/** @var string The DEFAULT clause required to drop defaults.*/
public $drop_default_value = null;
public $sequence_extra_code = true; //Does the generator need to add extra code to generate the sequence fields
public $sequence_name = ''; //Particular name for inline sequences in this generator
public $sequence_cache_size = 20; //Size of the sequences values cache (20 = Oracle Default)
/** @var bool To decide if the default clause of each field must go after the null clause.*/
public $default_after_null = false;
public $alter_column_sql = 'ALTER TABLE TABLENAME MODIFY (COLUMNSPECS)'; //The SQL template to alter columns
/** @var bool True if the generator needs to add extra code to generate the sequence fields.*/
public $sequence_extra_code = true;
/** @var string The particular name for inline sequences in this generator.*/
public $sequence_name = '';
/** @var string The SQL template to alter columns where the 'TABLENAME' and 'COLUMNSPECS' keywords are dynamically replaced.*/
public $alter_column_sql = 'ALTER TABLE TABLENAME MODIFY (COLUMNSPECS)';
/** @var int var ugly Oracle hack - size of the sequences values cache (20 = Default)*/
public $sequence_cache_size = 20;
/**
* Reset a sequence to the id field of a table.
* @param string $table name of table or xmldb_table object
* @return array sql commands to execute
*
* @param xmldb_table|string $table name of table or the table object.
* @return array of sql statements
*/
public function getResetSequenceSQL($table) {
@@ -78,7 +99,7 @@ class oracle_sql_generator extends sql_generator {
$seqname = $this->getSequenceFromDB($xmldb_table);
if (!$seqname) {
/// Fallback, seqname not found, something is wrong. Inform and use the alternative getNameForObject() method
// Fallback, seqname not found, something is wrong. Inform and use the alternative getNameForObject() method
$seqname = $this->getNameForObject($table, 'id', 'seq');
}
@@ -95,14 +116,14 @@ class oracle_sql_generator extends sql_generator {
* @return string the correct name of the table
*/
public function getTableName(xmldb_table $xmldb_table, $quoted=true) {
/// Get the name, supporting special oci names for temp tables
// Get the name, supporting special oci names for temp tables
if ($this->temptables->is_temptable($xmldb_table->getName())) {
$tablename = $this->temptables->get_correct_name($xmldb_table->getName());
} else {
$tablename = $this->prefix . $xmldb_table->getName();
}
/// Apply quotes optionally
// Apply quotes optionally
if ($quoted) {
$tablename = $this->getEncQuoted($tablename);
}
@@ -112,7 +133,10 @@ class oracle_sql_generator extends sql_generator {
/**
* Given one correct xmldb_table, returns the SQL statements
* to create temporary table (inside one array)
* to create temporary table (inside one array).
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @return array of sql statements
*/
public function getCreateTempTableSQL($xmldb_table) {
$this->temptables->add_temptable($xmldb_table->getName());
@@ -138,7 +162,12 @@ class oracle_sql_generator extends sql_generator {
}
/**
* Given one XMLDB Type, length and decimals, returns the DB proper SQL type
* Given one XMLDB Type, length and decimals, returns the DB proper SQL type.
*
* @param int $xmldb_type The xmldb_type defined constant. XMLDB_TYPE_INTEGER and other XMLDB_TYPE_* constants.
* @param int $xmldb_length The length of that data type.
* @param int $xmldb_decimals The decimal places of precision of the data type.
* @return string The DB defined data type.
*/
public function getTypeSQL($xmldb_type, $xmldb_length=null, $xmldb_decimals=null) {
@@ -152,7 +181,7 @@ class oracle_sql_generator extends sql_generator {
case XMLDB_TYPE_FLOAT:
case XMLDB_TYPE_NUMBER:
$dbtype = $this->number_type;
/// 38 is the max allowed
// 38 is the max allowed
if ($xmldb_length > 38) {
$xmldb_length = 38;
}
@@ -188,7 +217,12 @@ class oracle_sql_generator extends sql_generator {
}
/**
* Returns the code needed to create one sequence for the xmldb_table and xmldb_field passes
* Returns the code (array of statements) needed
* to create one sequence for the xmldb_table and xmldb_field passed in.
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param xmldb_field $xmldb_field The xmldb_field object instance.
* @return array Array of SQL statements to create the sequence.
*/
public function getCreateSequenceSQL($xmldb_table, $xmldb_field) {
@@ -207,6 +241,11 @@ class oracle_sql_generator extends sql_generator {
/**
* Returns the code needed to create one trigger for the xmldb_table and xmldb_field passed
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param xmldb_field $xmldb_field The xmldb_field object instance.
* @param string $sequence_name
* @return array Array of SQL statements to create the sequence.
*/
public function getCreateTriggerSQL($xmldb_table, $xmldb_field, $sequence_name) {
@@ -228,6 +267,11 @@ class oracle_sql_generator extends sql_generator {
/**
* Returns the code needed to drop one sequence for the xmldb_table and xmldb_field passed
* Can, optionally, specify if the underlying trigger will be also dropped
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param xmldb_field $xmldb_field The xmldb_field object instance.
* @param bool $include_trigger
* @return array Array of SQL statements to create the sequence.
*/
public function getDropSequenceSQL($xmldb_table, $xmldb_field, $include_trigger=false) {
@@ -245,7 +289,10 @@ class oracle_sql_generator extends sql_generator {
}
/**
* Returns the code (in array) needed to add one comment to the table
* Returns the code (array of statements) needed to add one comment to the table.
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @return array Array of SQL statements to add one comment to the table.
*/
function getCommentSQL ($xmldb_table) {
@@ -257,6 +304,9 @@ class oracle_sql_generator extends sql_generator {
/**
* Returns the code (array of statements) needed to execute extra statements on table drop
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @return array Array of extra SQL statements to drop a table.
*/
public function getDropTableExtraSQL($xmldb_table) {
$xmldb_field = new xmldb_field('id'); // Fields having sequences should be exclusively, id.
@@ -264,7 +314,11 @@ class oracle_sql_generator extends sql_generator {
}
/**
* Returns the code (array of statements) needed to execute extra statements on table rename
* Returns the code (array of statements) needed to execute extra statements on table rename.
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param string $newname The new name for the table.
* @return array Array of extra SQL statements to rename a table.
*/
public function getRenameTableExtraSQL($xmldb_table, $newname) {
@@ -278,28 +332,36 @@ class oracle_sql_generator extends sql_generator {
$oldtriggername = $this->getTriggerFromDB($xmldb_table);
$newtriggername = $this->getNameForObject($newname, $xmldb_field->getName(), 'trg');
/// Drop old trigger (first of all)
// Drop old trigger (first of all)
$results[] = "DROP TRIGGER " . $oldtriggername;
/// Rename the sequence, disablig CACHE before and enablig it later
/// to avoid consuming of values on rename
// Rename the sequence, disablig CACHE before and enablig it later
// to avoid consuming of values on rename
$results[] = 'ALTER SEQUENCE ' . $oldseqname . ' NOCACHE';
$results[] = 'RENAME ' . $oldseqname . ' TO ' . $newseqname;
$results[] = 'ALTER SEQUENCE ' . $newseqname . ' CACHE ' . $this->sequence_cache_size;
/// Create new trigger
$newt = new xmldb_table($newname); /// Temp table for trigger code generation
// Create new trigger
$newt = new xmldb_table($newname); // Temp table for trigger code generation
$results = array_merge($results, $this->getCreateTriggerSQL($newt, $xmldb_field, $newseqname));
return $results;
}
/**
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to alter the field in the table
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to alter the field in the table.
*
* Oracle has some severe limits:
* - clob and blob fields doesn't allow type to be specified
* - error is dropped if the null/not null clause is specified and hasn't changed
* - changes in precision/decimals of numeric fields drop an ORA-1440 error
*
* @param xmldb_table $xmldb_table The table related to $xmldb_field.
* @param xmldb_field $xmldb_field The instance of xmldb_field to create the SQL from.
* @param string $skip_type_clause The type clause on alter columns, NULL by default.
* @param string $skip_default_clause The default clause on alter columns, NULL by default.
* @param string $skip_notnull_clause The null/notnull clause on alter columns, NULL by default.
* @return string The field altering SQL statement.
*/
public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL) {
@@ -307,20 +369,20 @@ class oracle_sql_generator extends sql_generator {
$skip_default_clause = is_null($skip_default_clause) ? $this->alter_column_skip_default : $skip_default_clause;
$skip_notnull_clause = is_null($skip_notnull_clause) ? $this->alter_column_skip_notnull : $skip_notnull_clause;
$results = array(); /// To store all the needed SQL commands
$results = array(); // To store all the needed SQL commands
/// Get the quoted name of the table and field
// Get the quoted name of the table and field
$tablename = $this->getTableName($xmldb_table);
$fieldname = $xmldb_field->getName();
/// Take a look to field metadata
// Take a look to field metadata
$meta = $this->mdb->get_columns($xmldb_table->getName());
$metac = $meta[$fieldname];
$oldmetatype = $metac->meta_type;
$oldlength = $metac->max_length;
/// To calculate the oldlength if the field is numeric, we need to perform one extra query
/// because ADOdb has one bug here. http://phplens.com/lens/lensforum/msgs.php?id=15883
// To calculate the oldlength if the field is numeric, we need to perform one extra query
// because ADOdb has one bug here. http://phplens.com/lens/lensforum/msgs.php?id=15883
if ($oldmetatype == 'N') {
$uppertablename = strtoupper($tablename);
$upperfieldname = strtoupper($fieldname);
@@ -343,7 +405,7 @@ class oracle_sql_generator extends sql_generator {
$from_temp_fields = false; //By default don't assume we are going to use temporal fields
/// Detect if we are changing the type of the column
// Detect if we are changing the type of the column
if (($xmldb_field->getType() == XMLDB_TYPE_INTEGER && $oldmetatype == 'I') ||
($xmldb_field->getType() == XMLDB_TYPE_NUMBER && $oldmetatype == 'N') ||
($xmldb_field->getType() == XMLDB_TYPE_FLOAT && $oldmetatype == 'F') ||
@@ -352,14 +414,14 @@ class oracle_sql_generator extends sql_generator {
($xmldb_field->getType() == XMLDB_TYPE_BINARY && $oldmetatype == 'B')) {
$typechanged = false;
}
/// Detect if precision has changed
// Detect if precision has changed
if (($xmldb_field->getType() == XMLDB_TYPE_TEXT) ||
($xmldb_field->getType() == XMLDB_TYPE_BINARY) ||
($oldlength == -1) ||
($xmldb_field->getLength() == $oldlength)) {
$precisionchanged = false;
}
/// Detect if decimal has changed
// Detect if decimal has changed
if (($xmldb_field->getType() == XMLDB_TYPE_INTEGER) ||
($xmldb_field->getType() == XMLDB_TYPE_CHAR) ||
($xmldb_field->getType() == XMLDB_TYPE_TEXT) ||
@@ -369,29 +431,29 @@ class oracle_sql_generator extends sql_generator {
($xmldb_field->getDecimals() == $olddecimals)) {
$decimalchanged = false;
}
/// Detect if we are changing the default
// Detect if we are changing the default
if (($xmldb_field->getDefault() === null && $olddefault === null) ||
($xmldb_field->getDefault() === $olddefault) || //Check both equality and
("'" . $xmldb_field->getDefault() . "'" === $olddefault)) { //Equality with quotes because ADOdb returns the default with quotes
$defaultchanged = false;
}
/// Detect if we are changing the nullability
// Detect if we are changing the nullability
if (($xmldb_field->getNotnull() === $oldnotnull)) {
$notnullchanged = false;
}
/// If type has changed or precision or decimal has changed and we are in one numeric field
/// - create one temp column with the new specs
/// - fill the new column with the values from the old one
/// - drop the old column
/// - rename the temp column to the original name
// If type has changed or precision or decimal has changed and we are in one numeric field
// - create one temp column with the new specs
// - fill the new column with the values from the old one
// - drop the old column
// - rename the temp column to the original name
if (($typechanged) || (($oldmetatype == 'N' || $oldmetatype == 'I') && ($precisionchanged || $decimalchanged))) {
$tempcolname = $xmldb_field->getName() . '___tmp'; // Short tmp name, surely not conflicting ever
if (strlen($tempcolname) > 30) { // Safeguard we don't excess the 30cc limit
$tempcolname = 'ongoing_alter_column_tmp';
}
/// Prevent temp field to have both NULL/NOT NULL and DEFAULT constraints
// Prevent temp field to have both NULL/NOT NULL and DEFAULT constraints
$skip_notnull_clause = true;
$skip_default_clause = true;
$xmldb_field->setName($tempcolname);
@@ -400,9 +462,9 @@ class oracle_sql_generator extends sql_generator {
if (isset($meta[$tempcolname])) {
$results = array_merge($results, $this->getDropFieldSQL($xmldb_table, $xmldb_field));
}
/// Create the temporal column
// Create the temporal column
$results = array_merge($results, $this->getAddFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause, $skip_type_clause, $skip_notnull_clause));
/// Copy contents from original col to the temporal one
// Copy contents from original col to the temporal one
// From TEXT to integer/number we need explicit conversion
if ($oldmetatype == 'X' && $xmldb_field->GetType() == XMLDB_TYPE_INTEGER) {
@@ -414,47 +476,47 @@ class oracle_sql_generator extends sql_generator {
} else {
$results[] = 'UPDATE ' . $tablename . ' SET ' . $tempcolname . ' = ' . $fieldname;
}
/// Drop the old column
// Drop the old column
$xmldb_field->setName($fieldname); //Set back the original field name
$results = array_merge($results, $this->getDropFieldSQL($xmldb_table, $xmldb_field));
/// Rename the temp column to the original one
// Rename the temp column to the original one
$results[] = 'ALTER TABLE ' . $tablename . ' RENAME COLUMN ' . $tempcolname . ' TO ' . $fieldname;
/// Mark we have performed one change based in temp fields
// Mark we have performed one change based in temp fields
$from_temp_fields = true;
/// Re-enable the notnull and default sections so the general AlterFieldSQL can use it
// Re-enable the notnull and default sections so the general AlterFieldSQL can use it
$skip_notnull_clause = false;
$skip_default_clause = false;
/// Dissable the type section because we have done it with the temp field
// Disable the type section because we have done it with the temp field
$skip_type_clause = true;
/// If new field is nullable, nullability hasn't changed
// If new field is nullable, nullability hasn't changed
if (!$xmldb_field->getNotnull()) {
$notnullchanged = false;
}
/// If new field hasn't default, default hasn't changed
// If new field hasn't default, default hasn't changed
if ($xmldb_field->getDefault() === null) {
$defaultchanged = false;
}
}
/// If type and precision and decimals hasn't changed, prevent the type clause
// If type and precision and decimals hasn't changed, prevent the type clause
if (!$typechanged && !$precisionchanged && !$decimalchanged) {
$skip_type_clause = true;
}
/// If NULL/NOT NULL hasn't changed
/// prevent null clause to be specified
// If NULL/NOT NULL hasn't changed
// prevent null clause to be specified
if (!$notnullchanged) {
$skip_notnull_clause = true; /// Initially, prevent the notnull clause
/// But, if we have used the temp field and the new field is not null, then enforce the not null clause
$skip_notnull_clause = true; // Initially, prevent the notnull clause
// But, if we have used the temp field and the new field is not null, then enforce the not null clause
if ($from_temp_fields && $xmldb_field->getNotnull()) {
$skip_notnull_clause = false;
}
}
/// If default hasn't changed
/// prevent default clause to be specified
// If default hasn't changed
// prevent default clause to be specified
if (!$defaultchanged) {
$skip_default_clause = true; /// Initially, prevent the default clause
/// But, if we have used the temp field and the new field has default clause, then enforce the default clause
$skip_default_clause = true; // Initially, prevent the default clause
// But, if we have used the temp field and the new field has default clause, then enforce the default clause
if ($from_temp_fields) {
$default_clause = $this->getDefaultClause($xmldb_field);
if ($default_clause) {
@@ -463,33 +525,45 @@ class oracle_sql_generator extends sql_generator {
}
}
/// If arriving here, something is not being skipped (type, notnull, default), calculate the standard AlterFieldSQL
// If arriving here, something is not being skipped (type, notnull, default), calculate the standard AlterFieldSQL
if (!$skip_type_clause || !$skip_notnull_clause || !$skip_default_clause) {
$results = array_merge($results, parent::getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause, $skip_default_clause, $skip_notnull_clause));
return $results;
}
/// Finally return results
// Finally return results
return $results;
}
/**
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to create its default
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default
* (usually invoked from getModifyDefaultSQL()
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param xmldb_field $xmldb_field The xmldb_field object instance.
* @return array Array of SQL statements to create a field's default.
*/
public function getCreateDefaultSQL($xmldb_table, $xmldb_field) {
/// Just a wrapper over the getAlterFieldSQL() function for Oracle that
/// is capable of handling defaults
// Just a wrapper over the getAlterFieldSQL() function for Oracle that
// is capable of handling defaults
return $this->getAlterFieldSQL($xmldb_table, $xmldb_field);
}
/**
* Given one xmldb_table and one xmldb_field, return the SQL statements needded to drop its default
* Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default
* (usually invoked from getModifyDefaultSQL()
*
* Note that this method may be dropped in future.
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @param xmldb_field $xmldb_field The xmldb_field object instance.
* @return array Array of SQL statements to create a field's default.
*
* @todo MDL-31147 Moodle 2.1 - Drop getDropDefaultSQL()
*/
public function getDropDefaultSQL($xmldb_table, $xmldb_field) {
/// Just a wrapper over the getAlterFieldSQL() function for Oracle that
/// is capable of handling defaults
// Just a wrapper over the getAlterFieldSQL() function for Oracle that
// is capable of handling defaults
return $this->getAlterFieldSQL($xmldb_table, $xmldb_field);
}
@@ -499,7 +573,8 @@ class oracle_sql_generator extends sql_generator {
* The sequence name for oracle is calculated by looking the corresponding
* trigger and retrieving the sequence name from it (because sequences are
* independent elements)
* If no sequence is found, returns false
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @return string|bool If no sequence is found, returns false
*/
public function getSequenceFromDB($xmldb_table) {
@@ -511,7 +586,7 @@ class oracle_sql_generator extends sql_generator {
FROM user_triggers
WHERE table_name = ? AND trigger_name LIKE ?",
array($tablename, "{$prefixupper}%_ID%_TRG"))) {
/// If trigger found, regexp it looking for the sequence name
// If trigger found, regexp it looking for the sequence name
preg_match('/.*SELECT (.*)\.nextval/i', $trigger->trigger_body, $matches);
if (isset($matches[1])) {
$sequencename = $matches[1];
@@ -524,7 +599,9 @@ class oracle_sql_generator extends sql_generator {
/**
* Given one xmldb_table returns one string with the trigger
* in the table (fetched from DB)
* If no trigger is found, returns false
*
* @param xmldb_table $xmldb_table The xmldb_table object instance.
* @return string|bool If no trigger is found, returns false
*/
public function getTriggerFromDB($xmldb_table) {
@@ -543,9 +620,17 @@ class oracle_sql_generator extends sql_generator {
}
/**
* 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()
* Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg).
*
* (MySQL requires the whole xmldb_table object to be specified, so we add it always)
*
* This is invoked from getNameForObject().
* Only some DB have this implemented.
*
* @param string $object_name The object's name to check for.
* @param string $type The object's type (pk, uk, fk, ck, ix, uix, seq, trg).
* @param string $table_name The table's name to check in
* @return bool If such name is currently in use (true) or no (false)
*/
public function isNameInUse($object_name, $type, $table_name) {
switch($type) {
@@ -573,6 +658,11 @@ class oracle_sql_generator extends sql_generator {
return false; //No name in use found
}
/**
* Adds slashes to string.
* @param string $s
* @return string The escaped string.
*/
public function addslashes($s) {
// do not use php addslashes() because it depends on PHP quote settings!
$s = str_replace("'", "''", $s);
@@ -581,10 +671,11 @@ class oracle_sql_generator extends sql_generator {
/**
* Returns an array of reserved words (lowercase) for this DB
* @return array An array of database specific reserved words
*/
public static function getReservedWords() {
/// This file contains the reserved words for Oracle databases
/// from http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/ap_keywd.htm
// This file contains the reserved words for Oracle databases
// from http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/ap_keywd.htm
$reserved_words = array (
'access', 'add', 'all', 'alter', 'and', 'any',
'as', 'asc', 'audit', 'between', 'by', 'char',