[jOOQ/jOOQ#14441] Support parsing && and ! logical operators in MySQL
This includes: - [jOOQ/jOOQ#14442] Add ParserContext::parseCategory
This commit is contained in:
parent
5b13bc1d40
commit
68de5bfa35
@ -74,6 +74,12 @@ public interface ParseContext extends Scope {
|
||||
@NotNull
|
||||
SQLDialect parseFamily();
|
||||
|
||||
/**
|
||||
* Convenient access to {@link Settings#getParseDialect()}'s category.
|
||||
*/
|
||||
@NotNull
|
||||
SQLDialectCategory parseCategory();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Parse context
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -660,6 +660,7 @@ import org.jooq.Row;
|
||||
import org.jooq.Row2;
|
||||
import org.jooq.SQL;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.SQLDialectCategory;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Select;
|
||||
import org.jooq.SelectField;
|
||||
@ -6360,7 +6361,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
private final QueryPart parseAnd() {
|
||||
QueryPart condition = parseNot();
|
||||
|
||||
while (!forbidden.contains(FK_AND) && parseKeywordIf("AND"))
|
||||
while (!forbidden.contains(FK_AND) && parseKeywordIf("AND") || parseCategory() == SQLDialectCategory.MYSQL && parseIf("&&"))
|
||||
condition = toCondition(condition).and(toCondition(parseNot()));
|
||||
|
||||
return condition;
|
||||
@ -6385,7 +6386,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
private final int parseNot0() {
|
||||
int not = 0;
|
||||
|
||||
while (parseKeywordIf("NOT"))
|
||||
while (parseKeywordIf("NOT") || parseCategory() == SQLDialectCategory.MYSQL && parseIf('!'))
|
||||
not++;
|
||||
|
||||
return not;
|
||||
@ -14330,6 +14331,11 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
return parseDialect().family();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SQLDialectCategory parseCategory() {
|
||||
return parseDialect().category();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LanguageContext languageContext() {
|
||||
return languageContext;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user