empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r1667951 - /empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
Date Fri, 20 Mar 2015 08:38:02 GMT
Author: francisdb
Date: Fri Mar 20 08:38:01 2015
New Revision: 1667951

URL: http://svn.apache.org/r1667951
Log:
fix EMPIREDB-218 Missing reserved keywords in DBDatabaseDriverMySQL

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java?rev=1667951&r1=1667950&r2=1667951&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
(original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
Fri Mar 20 08:38:01 2015
@@ -119,8 +119,247 @@ public class DBDatabaseDriverMySQL exten
     public DBDatabaseDriverMySQL()
     {
         // Default Constructor
+    	setReservedKeywords();
     }
 
+    private void addReservedKeyWord(final String keyWord){
+        boolean added = reservedSQLKeywords.add(keyWord.toLowerCase());
+        if(!added){
+            log.debug("Existing keyWord added: " + keyWord);
+        }
+    }
+    
+    private void setReservedKeywords(){
+        // list of reserved keywords
+        // http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
+    	addReservedKeyWord("ACCESSIBLE".toLowerCase());
+    	addReservedKeyWord("ADD".toLowerCase());
+    	addReservedKeyWord("ALL".toLowerCase());
+    	addReservedKeyWord("ALTER".toLowerCase());
+    	addReservedKeyWord("ANALYZE".toLowerCase());
+    	addReservedKeyWord("AND".toLowerCase());
+    	addReservedKeyWord("AS".toLowerCase());
+    	addReservedKeyWord("ASC".toLowerCase());
+    	addReservedKeyWord("ASENSITIVE".toLowerCase());
+    	addReservedKeyWord("BEFORE".toLowerCase());
+    	addReservedKeyWord("BETWEEN".toLowerCase());
+    	addReservedKeyWord("BIGINT".toLowerCase());
+    	addReservedKeyWord("BINARY".toLowerCase());
+    	addReservedKeyWord("BLOB".toLowerCase());
+    	addReservedKeyWord("BOTH".toLowerCase());
+    	addReservedKeyWord("BY".toLowerCase());
+    	addReservedKeyWord("CALL".toLowerCase());
+    	addReservedKeyWord("CASCADE".toLowerCase());
+    	addReservedKeyWord("CASE".toLowerCase());
+    	addReservedKeyWord("CHANGE".toLowerCase());
+    	addReservedKeyWord("CHAR".toLowerCase());
+    	addReservedKeyWord("CHARACTER".toLowerCase());
+    	addReservedKeyWord("CHECK".toLowerCase());
+    	addReservedKeyWord("COLLATE".toLowerCase());
+    	addReservedKeyWord("COLUMN".toLowerCase());
+    	addReservedKeyWord("CONDITION".toLowerCase());
+    	addReservedKeyWord("CONSTRAINT".toLowerCase());
+    	addReservedKeyWord("CONTINUE".toLowerCase());
+    	addReservedKeyWord("CONVERT".toLowerCase());
+    	addReservedKeyWord("CREATE".toLowerCase());
+    	addReservedKeyWord("CROSS".toLowerCase());
+    	addReservedKeyWord("CURRENT_DATE".toLowerCase());
+    	addReservedKeyWord("CURRENT_TIME".toLowerCase());
+    	addReservedKeyWord("CURRENT_TIMESTAMP".toLowerCase());
+    	addReservedKeyWord("CURRENT_USER".toLowerCase());
+    	addReservedKeyWord("CURSOR".toLowerCase());
+    	addReservedKeyWord("DATABASE".toLowerCase());
+    	addReservedKeyWord("DATABASES".toLowerCase());
+    	addReservedKeyWord("DAY_HOUR".toLowerCase());
+    	addReservedKeyWord("DAY_MICROSECOND".toLowerCase());
+    	addReservedKeyWord("DAY_MINUTE".toLowerCase());
+    	addReservedKeyWord("DAY_SECOND".toLowerCase());
+    	addReservedKeyWord("DEC".toLowerCase());
+    	addReservedKeyWord("DECIMAL".toLowerCase());
+    	addReservedKeyWord("DECLARE".toLowerCase());
+    	addReservedKeyWord("DEFAULT".toLowerCase());
+    	addReservedKeyWord("DELAYED".toLowerCase());
+    	addReservedKeyWord("DELETE".toLowerCase());
+    	addReservedKeyWord("DESC".toLowerCase());
+    	addReservedKeyWord("DESCRIBE".toLowerCase());
+    	addReservedKeyWord("DETERMINISTIC".toLowerCase());
+    	addReservedKeyWord("DISTINCT".toLowerCase());
+    	addReservedKeyWord("DISTINCTROW".toLowerCase());
+    	addReservedKeyWord("DIV".toLowerCase());
+    	addReservedKeyWord("DOUBLE".toLowerCase());
+    	addReservedKeyWord("DROP".toLowerCase());
+    	addReservedKeyWord("DUAL".toLowerCase());
+    	addReservedKeyWord("EACH".toLowerCase());
+    	addReservedKeyWord("ELSE".toLowerCase());
+    	addReservedKeyWord("ELSEIF".toLowerCase());
+    	addReservedKeyWord("ENCLOSED".toLowerCase());
+    	addReservedKeyWord("ESCAPED".toLowerCase());
+    	addReservedKeyWord("EXISTS".toLowerCase());
+    	addReservedKeyWord("EXIT".toLowerCase());
+    	addReservedKeyWord("EXPLAIN".toLowerCase());
+    	addReservedKeyWord("FALSE".toLowerCase());
+    	addReservedKeyWord("FETCH".toLowerCase());
+    	addReservedKeyWord("FLOAT".toLowerCase());
+    	addReservedKeyWord("FLOAT4".toLowerCase());
+    	addReservedKeyWord("FLOAT8".toLowerCase());
+    	addReservedKeyWord("FOR".toLowerCase());
+    	addReservedKeyWord("FORCE".toLowerCase());
+    	addReservedKeyWord("FOREIGN".toLowerCase());
+    	addReservedKeyWord("FROM".toLowerCase());
+    	addReservedKeyWord("FULLTEXT".toLowerCase());
+    	addReservedKeyWord("GRANT".toLowerCase());
+    	addReservedKeyWord("GROUP".toLowerCase());
+    	addReservedKeyWord("HAVING".toLowerCase());
+    	addReservedKeyWord("HIGH_PRIORITY".toLowerCase());
+    	addReservedKeyWord("HOUR_MICROSECOND".toLowerCase());
+    	addReservedKeyWord("HOUR_MINUTE".toLowerCase());
+    	addReservedKeyWord("HOUR_SECOND".toLowerCase());
+    	addReservedKeyWord("IF".toLowerCase());
+    	addReservedKeyWord("IGNORE".toLowerCase());
+    	addReservedKeyWord("IN".toLowerCase());
+    	addReservedKeyWord("INDEX".toLowerCase());
+    	addReservedKeyWord("INFILE".toLowerCase());
+    	addReservedKeyWord("INNER".toLowerCase());
+    	addReservedKeyWord("INOUT".toLowerCase());
+    	addReservedKeyWord("INSENSITIVE".toLowerCase());
+    	addReservedKeyWord("INSERT".toLowerCase());
+    	addReservedKeyWord("INT".toLowerCase());
+    	addReservedKeyWord("INT1".toLowerCase());
+    	addReservedKeyWord("INT2".toLowerCase());
+    	addReservedKeyWord("INT3".toLowerCase());
+    	addReservedKeyWord("INT4".toLowerCase());
+    	addReservedKeyWord("INT8".toLowerCase());
+    	addReservedKeyWord("INTEGER".toLowerCase());
+    	addReservedKeyWord("INTERVAL".toLowerCase());
+    	addReservedKeyWord("INTO".toLowerCase());
+    	addReservedKeyWord("IS".toLowerCase());
+    	addReservedKeyWord("ITERATE".toLowerCase());
+    	addReservedKeyWord("JOIN".toLowerCase());
+    	addReservedKeyWord("KEY".toLowerCase());
+    	addReservedKeyWord("KEYS".toLowerCase());
+    	addReservedKeyWord("KILL".toLowerCase());
+    	addReservedKeyWord("LEADING".toLowerCase());
+    	addReservedKeyWord("LEAVE".toLowerCase());
+    	addReservedKeyWord("LEFT".toLowerCase());
+    	addReservedKeyWord("LIKE".toLowerCase());
+    	addReservedKeyWord("LIMIT".toLowerCase());
+    	addReservedKeyWord("LINEAR".toLowerCase());
+    	addReservedKeyWord("LINES".toLowerCase());
+    	addReservedKeyWord("LOAD".toLowerCase());
+    	addReservedKeyWord("LOCALTIME".toLowerCase());
+    	addReservedKeyWord("LOCALTIMESTAMP".toLowerCase());
+    	addReservedKeyWord("LOCK".toLowerCase());
+    	addReservedKeyWord("LONG".toLowerCase());
+    	addReservedKeyWord("LONGBLOB".toLowerCase());
+    	addReservedKeyWord("LONGTEXT".toLowerCase());
+    	addReservedKeyWord("LOOP".toLowerCase());
+    	addReservedKeyWord("LOW_PRIORITY".toLowerCase());
+    	addReservedKeyWord("MASTER_SSL_VERIFY_SERVER_CERT".toLowerCase());
+    	addReservedKeyWord("MATCH".toLowerCase());
+    	addReservedKeyWord("MAXVALUE".toLowerCase());
+    	addReservedKeyWord("MEDIUMBLOB".toLowerCase());
+    	addReservedKeyWord("MEDIUMINT".toLowerCase());
+    	addReservedKeyWord("MEDIUMTEXT".toLowerCase());
+    	addReservedKeyWord("MIDDLEINT".toLowerCase());
+    	addReservedKeyWord("MINUTE_MICROSECOND".toLowerCase());
+    	addReservedKeyWord("MINUTE_SECOND".toLowerCase());
+    	addReservedKeyWord("MOD".toLowerCase());
+    	addReservedKeyWord("MODIFIES".toLowerCase());
+    	addReservedKeyWord("NATURAL".toLowerCase());
+    	addReservedKeyWord("NOT".toLowerCase());
+    	addReservedKeyWord("NO_WRITE_TO_BINLOG".toLowerCase());
+    	addReservedKeyWord("NULL".toLowerCase());
+    	addReservedKeyWord("NUMERIC".toLowerCase());
+    	addReservedKeyWord("ON".toLowerCase());
+    	addReservedKeyWord("OPTIMIZE".toLowerCase());
+    	addReservedKeyWord("OPTION".toLowerCase());
+    	addReservedKeyWord("OPTIONALLY".toLowerCase());
+    	addReservedKeyWord("OR".toLowerCase());
+    	addReservedKeyWord("ORDER".toLowerCase());
+    	addReservedKeyWord("OUT".toLowerCase());
+    	addReservedKeyWord("OUTER".toLowerCase());
+    	addReservedKeyWord("OUTFILE".toLowerCase());
+    	addReservedKeyWord("PRECISION".toLowerCase());
+    	addReservedKeyWord("PRIMARY".toLowerCase());
+    	addReservedKeyWord("PROCEDURE".toLowerCase());
+    	addReservedKeyWord("PURGE".toLowerCase());
+    	addReservedKeyWord("RANGE".toLowerCase());
+    	addReservedKeyWord("READ".toLowerCase());
+    	addReservedKeyWord("READS".toLowerCase());
+    	addReservedKeyWord("READ_WRITE".toLowerCase());
+    	addReservedKeyWord("REAL".toLowerCase());
+    	addReservedKeyWord("REFERENCES".toLowerCase());
+    	addReservedKeyWord("REGEXP".toLowerCase());
+    	addReservedKeyWord("RELEASE".toLowerCase());
+    	addReservedKeyWord("RENAME".toLowerCase());
+    	addReservedKeyWord("REPEAT".toLowerCase());
+    	addReservedKeyWord("REPLACE".toLowerCase());
+    	addReservedKeyWord("REQUIRE".toLowerCase());
+    	addReservedKeyWord("RESIGNAL".toLowerCase());
+    	addReservedKeyWord("RESTRICT".toLowerCase());
+    	addReservedKeyWord("RETURN".toLowerCase());
+    	addReservedKeyWord("REVOKE".toLowerCase());
+    	addReservedKeyWord("RIGHT".toLowerCase());
+    	addReservedKeyWord("RLIKE".toLowerCase());
+    	addReservedKeyWord("SCHEMA".toLowerCase());
+    	addReservedKeyWord("SCHEMAS".toLowerCase());
+    	addReservedKeyWord("SECOND_MICROSECOND".toLowerCase());
+    	addReservedKeyWord("SELECT".toLowerCase());
+    	addReservedKeyWord("SENSITIVE".toLowerCase());
+    	addReservedKeyWord("SEPARATOR".toLowerCase());
+    	addReservedKeyWord("SET".toLowerCase());
+    	addReservedKeyWord("SHOW".toLowerCase());
+    	addReservedKeyWord("SIGNAL".toLowerCase());
+    	addReservedKeyWord("SMALLINT".toLowerCase());
+    	addReservedKeyWord("SPATIAL".toLowerCase());
+    	addReservedKeyWord("SPECIFIC".toLowerCase());
+    	addReservedKeyWord("SQL".toLowerCase());
+    	addReservedKeyWord("SQLEXCEPTION".toLowerCase());
+    	addReservedKeyWord("SQLSTATE".toLowerCase());
+    	addReservedKeyWord("SQLWARNING".toLowerCase());
+    	addReservedKeyWord("SQL_BIG_RESULT".toLowerCase());
+    	addReservedKeyWord("SQL_CALC_FOUND_ROWS".toLowerCase());
+    	addReservedKeyWord("SQL_SMALL_RESULT".toLowerCase());
+    	addReservedKeyWord("SSL".toLowerCase());
+    	addReservedKeyWord("STARTING".toLowerCase());
+    	addReservedKeyWord("STRAIGHT_JOIN".toLowerCase());
+    	addReservedKeyWord("TABLE".toLowerCase());
+    	addReservedKeyWord("TERMINATED".toLowerCase());
+    	addReservedKeyWord("THEN".toLowerCase());
+    	addReservedKeyWord("TINYBLOB".toLowerCase());
+    	addReservedKeyWord("TINYINT".toLowerCase());
+    	addReservedKeyWord("TINYTEXT".toLowerCase());
+    	addReservedKeyWord("TO".toLowerCase());
+    	addReservedKeyWord("TRAILING".toLowerCase());
+    	addReservedKeyWord("TRIGGER".toLowerCase());
+    	addReservedKeyWord("TRUE".toLowerCase());
+    	addReservedKeyWord("UNDO".toLowerCase());
+    	addReservedKeyWord("UNION".toLowerCase());
+    	addReservedKeyWord("UNIQUE".toLowerCase());
+    	addReservedKeyWord("UNLOCK".toLowerCase());
+    	addReservedKeyWord("UNSIGNED".toLowerCase());
+    	addReservedKeyWord("UPDATE".toLowerCase());
+    	addReservedKeyWord("USAGE".toLowerCase());
+    	addReservedKeyWord("USE".toLowerCase());
+    	addReservedKeyWord("USING".toLowerCase());
+    	addReservedKeyWord("UTC_DATE".toLowerCase());
+    	addReservedKeyWord("UTC_TIME".toLowerCase());
+    	addReservedKeyWord("UTC_TIMESTAMP".toLowerCase());
+    	addReservedKeyWord("VALUES".toLowerCase());
+    	addReservedKeyWord("VARBINARY".toLowerCase());
+    	addReservedKeyWord("VARCHAR".toLowerCase());
+    	addReservedKeyWord("VARCHARACTER".toLowerCase());
+    	addReservedKeyWord("VARYING".toLowerCase());
+    	addReservedKeyWord("WHEN".toLowerCase());
+    	addReservedKeyWord("WHERE".toLowerCase());
+    	addReservedKeyWord("WHILE".toLowerCase());
+    	addReservedKeyWord("WITH".toLowerCase());
+    	addReservedKeyWord("WRITE".toLowerCase());
+    	addReservedKeyWord("XOR".toLowerCase());
+    	addReservedKeyWord("YEAR_MONTH".toLowerCase());
+    	addReservedKeyWord("ZEROFILL".toLowerCase());
+    }
+    
     /**
      * returns the name for the database / schema
      * @return the database / schema name



Mime
View raw message