[jOOQ/jOOQ#9131] Support parsing MySQL BIT(1) value literals
This commit is contained in:
parent
917796f484
commit
77a3943a65
@ -6582,6 +6582,10 @@ final class ParserImpl implements Parser {
|
||||
else if ((field = parseFieldBitwiseFunctionIf(ctx)) != null)
|
||||
return field;
|
||||
|
||||
if (B.is(type))
|
||||
if ((value = parseBitLiteralIf(ctx)) != null)
|
||||
return DSL.inline((Boolean) value);
|
||||
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
@ -10725,6 +10729,23 @@ final class ParserImpl implements Parser {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final Boolean parseBitLiteralIf(ParserContext ctx) {
|
||||
if (parseIf(ctx, "B'", false) || parseIf(ctx, "b'", false)) {
|
||||
boolean result = false;
|
||||
|
||||
if (!parseIf(ctx, '0') && parseIf(ctx, '1'))
|
||||
result = true;
|
||||
|
||||
if (parseIf(ctx, '0') || parseIf(ctx, '1'))
|
||||
throw ctx.exception("Currently, only BIT(1) literals are supported");
|
||||
|
||||
parse(ctx, '\'');
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final byte[] parseBinaryLiteralIf(ParserContext ctx) {
|
||||
if (parseIf(ctx, "X'", false) || parseIf(ctx, "x'", false)) {
|
||||
if (parseIf(ctx, '\''))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user