summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
authorVik <vmuriart@gmail.com>2016-06-28 14:24:48 -0700
committerGitHub <noreply@github.com>2016-06-28 14:24:48 -0700
commit1bc9ee9d7271a907b31c88fe6744c8a8d21cd252 (patch)
tree736819ecf502c55d14b3622b2d25995306b64c67 /sqlparse
parentdc74eb771432c73dc28cf46ac4a8b8b6d0351a94 (diff)
parentb2ba3dcc31b42e9e43e5df0a18877072fe058f96 (diff)
downloadsqlparse-1bc9ee9d7271a907b31c88fe6744c8a8d21cd252.tar.gz
Merge pull request #269 from dlenski/oracle-11g-keywords
add all Oracle 11g reserved words that aren't already in sqlparse.keywords
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/keywords.py135
1 files changed, 134 insertions, 1 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py
index 6f6955b..11ed7d3 100644
--- a/sqlparse/keywords.py
+++ b/sqlparse/keywords.py
@@ -12,7 +12,7 @@ from sqlparse import tokens
def is_keyword(value):
val = value.upper()
- return (KEYWORDS_COMMON.get(val) or KEYWORDS.get(val, tokens.Name)), value
+ return (KEYWORDS_COMMON.get(val) or KEYWORDS_ORACLE.get(val) or KEYWORDS.get(val, tokens.Name)), value
SQL_REGEX = {
@@ -100,6 +100,7 @@ KEYWORDS = {
'ANALYSE': tokens.Keyword,
'ANALYZE': tokens.Keyword,
'ANY': tokens.Keyword,
+ 'ARRAYLEN': tokens.Keyword,
'ARE': tokens.Keyword,
'ASC': tokens.Keyword.Order,
'ASENSITIVE': tokens.Keyword,
@@ -108,6 +109,7 @@ KEYWORDS = {
'ASYMMETRIC': tokens.Keyword,
'AT': tokens.Keyword,
'ATOMIC': tokens.Keyword,
+ 'AUDIT': tokens.Keyword,
'AUTHORIZATION': tokens.Keyword,
'AVG': tokens.Keyword,
@@ -155,6 +157,7 @@ KEYWORDS = {
'COLLECT': tokens.Keyword,
'COLUMN': tokens.Keyword,
'COLUMN_NAME': tokens.Keyword,
+ 'COMPRESS': tokens.Keyword,
'COMMAND_FUNCTION': tokens.Keyword,
'COMMAND_FUNCTION_CODE': tokens.Keyword,
'COMMENT': tokens.Keyword,
@@ -217,6 +220,7 @@ KEYWORDS = {
'DETERMINISTIC': tokens.Keyword,
'DIAGNOSTICS': tokens.Keyword,
'DICTIONARY': tokens.Keyword,
+ 'DISABLE': tokens.Keyword,
'DISCONNECT': tokens.Keyword,
'DISPATCH': tokens.Keyword,
'DO': tokens.Keyword,
@@ -226,6 +230,7 @@ KEYWORDS = {
'DYNAMIC_FUNCTION_CODE': tokens.Keyword,
'EACH': tokens.Keyword,
+ 'ENABLE': tokens.Keyword,
'ENCODING': tokens.Keyword,
'ENCRYPTED': tokens.Keyword,
'END-EXEC': tokens.Keyword,
@@ -245,6 +250,7 @@ KEYWORDS = {
'FALSE': tokens.Keyword,
'FETCH': tokens.Keyword,
+ 'FILE': tokens.Keyword,
'FINAL': tokens.Keyword,
'FIRST': tokens.Keyword,
'FORCE': tokens.Keyword,
@@ -275,6 +281,7 @@ KEYWORDS = {
'HOLD': tokens.Keyword,
'HOST': tokens.Keyword,
+ 'IDENTIFIED': tokens.Keyword,
'IDENTITY': tokens.Keyword,
'IGNORE': tokens.Keyword,
'ILIKE': tokens.Keyword,
@@ -290,6 +297,7 @@ KEYWORDS = {
'INDITCATOR': tokens.Keyword,
'INFIX': tokens.Keyword,
'INHERITS': tokens.Keyword,
+ 'INITIAL': tokens.Keyword,
'INITIALIZE': tokens.Keyword,
'INITIALLY': tokens.Keyword,
'INOUT': tokens.Keyword,
@@ -333,12 +341,14 @@ KEYWORDS = {
# 'M': tokens.Keyword,
'MAP': tokens.Keyword,
'MATCH': tokens.Keyword,
+ 'MAXEXTENTS': tokens.Keyword,
'MAXVALUE': tokens.Keyword,
'MESSAGE_LENGTH': tokens.Keyword,
'MESSAGE_OCTET_LENGTH': tokens.Keyword,
'MESSAGE_TEXT': tokens.Keyword,
'METHOD': tokens.Keyword,
'MINUTE': tokens.Keyword,
+ 'MINUS': tokens.Keyword,
'MINVALUE': tokens.Keyword,
'MOD': tokens.Keyword,
'MODE': tokens.Keyword,
@@ -357,13 +367,17 @@ KEYWORDS = {
'NEW': tokens.Keyword,
'NEXT': tokens.Keyword,
'NO': tokens.Keyword,
+ 'NOAUDIT': tokens.Keyword,
+ 'NOCOMPRESS': tokens.Keyword,
'NOCREATEDB': tokens.Keyword,
'NOCREATEUSER': tokens.Keyword,
'NONE': tokens.Keyword,
'NOT': tokens.Keyword,
+ 'NOTFOUND': tokens.Keyword,
'NOTHING': tokens.Keyword,
'NOTIFY': tokens.Keyword,
'NOTNULL': tokens.Keyword,
+ 'NOWAIT': tokens.Keyword,
'NULL': tokens.Keyword,
'NULLABLE': tokens.Keyword,
'NULLIF': tokens.Keyword,
@@ -372,9 +386,11 @@ KEYWORDS = {
'OCTET_LENGTH': tokens.Keyword,
'OF': tokens.Keyword,
'OFF': tokens.Keyword,
+ 'OFFLINE': tokens.Keyword,
'OFFSET': tokens.Keyword,
'OIDS': tokens.Keyword,
'OLD': tokens.Keyword,
+ 'ONLINE': tokens.Keyword,
'ONLY': tokens.Keyword,
'OPEN': tokens.Keyword,
'OPERATION': tokens.Keyword,
@@ -400,6 +416,7 @@ KEYWORDS = {
'PARAMATER_SPECIFIC_SCHEMA': tokens.Keyword,
'PARTIAL': tokens.Keyword,
'PASCAL': tokens.Keyword,
+ 'PCTFREE': tokens.Keyword,
'PENDANT': tokens.Keyword,
'PLACING': tokens.Keyword,
'PLI': tokens.Keyword,
@@ -418,6 +435,7 @@ KEYWORDS = {
'PUBLIC': tokens.Keyword,
'RAISE': tokens.Keyword,
+ 'RAW': tokens.Keyword,
'READ': tokens.Keyword,
'READS': tokens.Keyword,
'RECHECK': tokens.Keyword,
@@ -430,6 +448,7 @@ KEYWORDS = {
'RENAME': tokens.Keyword,
'REPEATABLE': tokens.Keyword,
'RESET': tokens.Keyword,
+ 'RESOURCE': tokens.Keyword,
'RESTART': tokens.Keyword,
'RESTRICT': tokens.Keyword,
'RESULT': tokens.Keyword,
@@ -483,6 +502,7 @@ KEYWORDS = {
'SPECIFICTYPE': tokens.Keyword,
'SPECIFIC_NAME': tokens.Keyword,
'SQL': tokens.Keyword,
+ 'SQLBUF': tokens.Keyword,
'SQLCODE': tokens.Keyword,
'SQLERROR': tokens.Keyword,
'SQLEXCEPTION': tokens.Keyword,
@@ -503,8 +523,10 @@ KEYWORDS = {
'SUBCLASS_ORIGIN': tokens.Keyword,
'SUBLIST': tokens.Keyword,
'SUBSTRING': tokens.Keyword,
+ 'SUCCESSFUL': tokens.Keyword,
'SUM': tokens.Keyword,
'SYMMETRIC': tokens.Keyword,
+ 'SYNONYM': tokens.Keyword,
'SYSID': tokens.Keyword,
'SYSTEM': tokens.Keyword,
'SYSTEM_USER': tokens.Keyword,
@@ -541,6 +563,7 @@ KEYWORDS = {
'TRUSTED': tokens.Keyword,
'TYPE': tokens.Keyword,
+ 'UID': tokens.Keyword,
'UNCOMMITTED': tokens.Keyword,
'UNDER': tokens.Keyword,
'UNENCRYPTED': tokens.Keyword,
@@ -562,6 +585,7 @@ KEYWORDS = {
'VACUUM': tokens.Keyword,
'VALID': tokens.Keyword,
+ 'VALIDATE': tokens.Keyword,
'VALIDATOR': tokens.Keyword,
'VALUES': tokens.Keyword,
'VARIABLE': tokens.Keyword,
@@ -601,10 +625,14 @@ KEYWORDS = {
'NUMBER': tokens.Name.Builtin,
'NUMERIC': tokens.Name.Builtin,
'REAL': tokens.Name.Builtin,
+ 'ROWID': tokens.Name.Builtin,
+ 'ROWLABEL': tokens.Name.Builtin,
+ 'ROWNUM': tokens.Name.Builtin,
'SERIAL': tokens.Name.Builtin,
'SERIAL8': tokens.Name.Builtin,
'SIGNED': tokens.Name.Builtin,
'SMALLINT': tokens.Name.Builtin,
+ 'SYSDATE': tokens.Name.Builtin,
'TEXT': tokens.Name.Builtin,
'TINYINT': tokens.Name.Builtin,
'UNSIGNED': tokens.Name.Builtin,
@@ -658,3 +686,108 @@ KEYWORDS_COMMON = {
'MAX': tokens.Keyword,
'DISTINCT': tokens.Keyword,
}
+
+KEYWORDS_ORACLE = {
+ 'ARCHIVE': tokens.Keyword,
+ 'ARCHIVELOG': tokens.Keyword,
+
+ 'BACKUP': tokens.Keyword,
+ 'BECOME': tokens.Keyword,
+ 'BLOCK': tokens.Keyword,
+ 'BODY': tokens.Keyword,
+
+ 'CANCEL': tokens.Keyword,
+ 'CHANGE': tokens.Keyword,
+ 'COMPILE': tokens.Keyword,
+ 'CONTENTS': tokens.Keyword,
+ 'CONTROLFILE': tokens.Keyword,
+
+ 'DATAFILE': tokens.Keyword,
+ 'DBA': tokens.Keyword,
+ 'DISMOUNT': tokens.Keyword,
+ 'DOUBLE': tokens.Keyword,
+ 'DUMP': tokens.Keyword,
+
+ 'EVENTS': tokens.Keyword,
+ 'EXCEPTIONS': tokens.Keyword,
+ 'EXPLAIN': tokens.Keyword,
+ 'EXTENT': tokens.Keyword,
+ 'EXTERNALLY': tokens.Keyword,
+
+ 'FLUSH': tokens.Keyword,
+ 'FREELIST': tokens.Keyword,
+ 'FREELISTS': tokens.Keyword,
+
+ 'GROUPS': tokens.Keyword,
+
+ 'INDICATOR': tokens.Keyword,
+ 'INITRANS': tokens.Keyword,
+ 'INSTANCE': tokens.Keyword,
+
+ 'LAYER': tokens.Keyword,
+ 'LINK': tokens.Keyword,
+ 'LISTS': tokens.Keyword,
+ 'LOGFILE': tokens.Keyword,
+
+ 'MANAGE': tokens.Keyword,
+ 'MANUAL': tokens.Keyword,
+ 'MAXDATAFILES': tokens.Keyword,
+ 'MAXINSTANCES': tokens.Keyword,
+ 'MAXLOGFILES': tokens.Keyword,
+ 'MAXLOGHISTORY': tokens.Keyword,
+ 'MAXLOGMEMBERS': tokens.Keyword,
+ 'MAXTRANS': tokens.Keyword,
+ 'MINEXTENTS': tokens.Keyword,
+ 'MODULE': tokens.Keyword,
+ 'MOUNT': tokens.Keyword,
+
+ 'NOARCHIVELOG': tokens.Keyword,
+ 'NOCACHE': tokens.Keyword,
+ 'NOCYCLE': tokens.Keyword,
+ 'NOMAXVALUE': tokens.Keyword,
+ 'NOMINVALUE': tokens.Keyword,
+ 'NOORDER': tokens.Keyword,
+ 'NORESETLOGS': tokens.Keyword,
+ 'NORMAL': tokens.Keyword,
+ 'NOSORT': tokens.Keyword,
+
+ 'OPTIMAL': tokens.Keyword,
+ 'OWN': tokens.Keyword,
+
+ 'PACKAGE': tokens.Keyword,
+ 'PARALLEL': tokens.Keyword,
+ 'PCTINCREASE': tokens.Keyword,
+ 'PCTUSED': tokens.Keyword,
+ 'PLAN': tokens.Keyword,
+ 'PRIVATE': tokens.Keyword,
+ 'PROFILE': tokens.Keyword,
+
+ 'QUOTA': tokens.Keyword,
+
+ 'RECOVER': tokens.Keyword,
+ 'RESETLOGS': tokens.Keyword,
+ 'RESTRICTED': tokens.Keyword,
+ 'REUSE': tokens.Keyword,
+ 'ROLES': tokens.Keyword,
+
+ 'SAVEPOINT': tokens.Keyword,
+ 'SCN': tokens.Keyword,
+ 'SECTION': tokens.Keyword,
+ 'SEGMENT': tokens.Keyword,
+ 'SHARED': tokens.Keyword,
+ 'SNAPSHOT': tokens.Keyword,
+ 'SORT': tokens.Keyword,
+ 'STATEMENT_ID': tokens.Keyword,
+ 'STOP': tokens.Keyword,
+ 'SWITCH': tokens.Keyword,
+
+ 'TABLES': tokens.Keyword,
+ 'TABLESPACE': tokens.Keyword,
+ 'THREAD': tokens.Keyword,
+ 'TIME': tokens.Keyword,
+ 'TRACING': tokens.Keyword,
+ 'TRANSACTION': tokens.Keyword,
+ 'TRIGGERS': tokens.Keyword,
+
+ 'UNLIMITED': tokens.Keyword,
+} \ No newline at end of file