Commit f81f9fa3 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1706263: Updating db keywords to be escaped"

parents 8c9b5e1b ff810611
......@@ -1231,7 +1231,7 @@ function install_view_layout_defaults() {
// Fetch all the existing layouts so we can check below whether each default already exists
$oldlayouts = array();
$layoutrecs = get_records_assoc('view_layout', 'iscustom', '0', '', 'id, rows, iscustom');
$layoutrecs = get_records_assoc('view_layout', 'iscustom', '0', '', 'id, "rows", iscustom');
if ($layoutrecs) {
foreach ($layoutrecs as $rec) {
$rows = get_records_sql_assoc(
......
......@@ -2943,7 +2943,7 @@ class View {
SELECT * FROM {view_layout} vl
JOIN {usr_custom_layout} ucl
ON ((vl.id = ucl.layout) AND ' . $andclause . ')
WHERE rows = ?', $queryarray);
WHERE "rows" = ?', $queryarray);
if ($layoutid) {
$layout->id = $layoutid;
......
......@@ -269,48 +269,66 @@ class XMLDBmysqli extends XMLDBGenerator {
*/
function getReservedWords() {
/// This file contains the reserved words for MySQL databases
/// from http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
/// from https://dev.mysql.com/doc/refman/8.0/en/keywords.html
/// and https://mariadb.com/kb/en/mariadb/reserved-words/
$reserved_words = array (
'add', 'all', 'alter', 'analyze', 'and', 'as', 'asc',
'accessible', 'add', 'admin', 'all', 'alter', 'analyze', 'and',
'as', 'asc',
'asensitive', 'before', 'between', 'bigint', 'binary',
'blob', 'both', 'by', 'call', 'cascade', 'case', 'change',
'char', 'character', 'check', 'collate', 'column', 'columns',
'condition', 'connection', 'constraint', 'continue',
'convert', 'create', 'cross', 'current_date', 'current_time',
'current_timestamp', 'current_user', 'cursor', 'database',
'databases', 'day_hour', 'day_microsecond',
'convert', 'create', 'cross', 'cube', 'cume_dist', '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',
'default', 'delayed', 'delete', 'dense_rank', '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',
'float8', 'for', 'force', 'foreign', 'from', 'fulltext', 'function',
'general', 'generated', 'get', 'grant', 'group', 'grouping',
'groups', 'having', 'high_priority', 'hour_microsecond',
'hour_minute', 'hour_second', 'if', 'ignore', 'ignore_server_ids',
'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',
'like', 'limit', 'lines', 'load', 'localtime', 'localtimestamp',
'int2', 'int3', 'int4', 'int8', 'integer', 'interval', 'into',
'io_after_gtids', 'io_before_gtids', 'is',
'iterate', 'join', 'key', 'keys', 'kill', 'lag', 'last_value',
'lead', 'leading', 'leave', 'left',
'like', 'limit', 'linear', 'lines', 'load', 'localtime',
'localtimestamp',
'lock', 'long', 'longblob', 'longtext', 'loop', 'low_priority',
'match', 'mediumblob', 'mediumint', 'mediumtext',
'master_bind',
'master_heartbeat_period', 'master_ssl_verify_server_cert',
'match', 'maxvalue', 'mediumblob', 'mediumint', 'mediumtext',
'middleint', 'minute_microsecond', 'minute_second',
'mod', 'modifies', 'natural', 'not', 'no_write_to_binlog',
'null', 'numeric', 'on', 'optimize', 'option', 'optionally',
'or', 'order', 'out', 'outer', 'outfile', 'precision', 'primary',
'procedure', 'purge', 'raid0', 'read', 'reads', 'real',
'references', 'regexp', 'release', 'rename', 'repeat', 'replace',
'require', 'restrict', 'return', 'revoke', 'right', 'rlike', 'schema',
'nth_value', 'ntile',
'null', 'numeric', 'of', 'on', 'optimize', 'optimizer_costs',
'option', 'optionally',
'or', 'order', 'out', 'outer', 'outfile', 'over',
'partition', 'percent_rank', 'persist', 'persist_only',
'precision', 'primary',
'procedure', 'purge', 'raid0', 'range', 'rank', 'read', 'reads',
'read_write', 'real',
'recursive', 'references', 'regexp', 'release', 'rename', 'repeat',
'replace',
'require', 'resignal', 'restrict', 'return', 'revoke', 'right',
'rlike', 'row', 'rows', 'row_number', 'schema',
'schemas', 'second_microsecond', 'select', 'sensitive',
'separator', 'set', 'show', 'smallint', 'soname', 'spatial',
'separator', 'set', 'show', 'signal', 'slow', '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',
'ssl', 'starting', 'stored', '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'
'varying', 'virtual', 'when', 'where', 'while', 'window',
'with', 'write', 'x509', 'xor', 'year_month', 'zerofill'
);
return $reserved_words;
}
......
......@@ -454,23 +454,31 @@ class XMLDBpostgres extends XMLDBgenerator {
*/
function getReservedWords() {
/// This file contains the reserved words for PostgreSQL databases
/// http://www.postgresql.org/docs/8.3/static/sql-keywords-appendix.html
/// https://www.postgresql.org/docs/10/static/sql-keywords-appendix.html
$reserved_words = array (
'all', 'analyse', 'analyze', 'and', 'any', 'array', 'as', 'asc',
'asymmetric', 'authorization', 'between', 'binary', 'both', 'case',
'cast', 'check', 'collate', 'column', 'constraint', 'create', 'cross',
'current_date', 'current_role', 'current_time', 'current_timestamp',
'cast', 'check', 'collate', 'collation', 'column', 'concurrently',
'constraint', 'create', 'cross', 'current_catalog',
'current_date', 'current_role', 'current_schema', 'current_time',
'current_timestamp',
'current_user', 'default', 'deferrable', 'desc', 'distinct', 'do',
'else', 'end', 'except', 'false', 'for', 'foreign', 'freeze', 'from',
'full', 'grant', 'group', 'having', 'ilike', 'in', 'initially', 'inner',
'intersect', 'into', 'is', 'isnull', 'join', 'leading', 'left', 'like',
'else', 'end', 'except', 'false', 'fetch', 'for', 'foreign',
'freeze', 'from',
'full', 'grant', 'group', 'having', 'ilike', 'in', 'initially',
'inner',
'intersect', 'into', 'is', 'isnull', 'join', 'lateral', 'leading',
'left', 'like',
'limit', 'localtime', 'localtimestamp', 'natural', 'new', 'not',
'notnull', 'null', 'off', 'offset', 'old', 'on', 'only', 'or', 'order',
'outer', 'overlaps', 'placing', 'primary', 'references', 'returning', 'right', 'select',
'session_user', 'similar', 'some', 'symmetric', 'table', 'then', 'to',
'outer', 'overlaps', 'placing', 'primary', 'references', 'returning',
'right', 'select',
'session_user', 'similar', 'some', 'symmetric', 'table', 'tablesample',
'then', 'to',
'trailing', 'true', 'union', 'unique', 'user', 'using', 'verbose',
'when', 'where', 'with',
'collation', 'concurrently', 'current_catalog', 'current_schema', 'fetch', 'lateral', 'over', 'variadic', 'window' // new reserved words in postgres 9.3
'variadic', 'when', 'where', 'window', 'with',
'collation', 'concurrently', 'current_catalog', 'current_schema',
'fetch', 'lateral', 'over', 'variadic', 'window'
);
return $reserved_words;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment