Skip to content

Commit

Permalink
for #567
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Jan 17, 2018
1 parent f5882ef commit 06c1979
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,23 @@ public static String getExactlyValue(final String value) {
* @return original SQL expression
*/
public static String getOriginalValue(final String value, final DatabaseType databaseType) {
if (DatabaseType.MySQL == databaseType) {
try {
DefaultKeyword.valueOf(value.toUpperCase());
MySQLKeyword.valueOf(value.toUpperCase());
return String.format("`%s`", value);
} catch (final IllegalArgumentException ex) {
return value;
}
if (DatabaseType.MySQL != databaseType) {
return value;
}
try {
DefaultKeyword.valueOf(value.toUpperCase());
return String.format("`%s`", value);
} catch (final IllegalArgumentException ex) {
return getOriginalValueForMySQLKeyword(value);
}
}

private static String getOriginalValueForMySQLKeyword(final String value) {
try {
MySQLKeyword.valueOf(value.toUpperCase());
return String.format("`%s`", value);
} catch (final IllegalArgumentException ex) {
return value;
}
return value;
}
}

0 comments on commit 06c1979

Please sign in to comment.