[#7087] Add support for Oracle's ALTER SESSION SET CURRENT_SCHEMA command
This commit is contained in:
parent
8f96a58c7d
commit
c8fb2031dc
@ -11,6 +11,7 @@ ddlStatement =
|
||||
| alterIndexStatement
|
||||
| alterSchemaStatement
|
||||
| alterSequenceStatement
|
||||
| alterSessionStatement
|
||||
| alterViewStatement
|
||||
| commentStatement
|
||||
| createTableStatement
|
||||
@ -95,6 +96,9 @@ alterSequenceStatement =
|
||||
)
|
||||
;
|
||||
|
||||
alterSessionStatement = 'ALTER SESSION' 'SET CURRENT_SCHEMA' '=' schemaName
|
||||
;
|
||||
|
||||
alterViewStatement = 'ALTER VIEW' [ 'IF EXISTS' ] tableName
|
||||
'RENAME TO' tableName
|
||||
;
|
||||
|
||||
@ -87,6 +87,7 @@ final class Keywords {
|
||||
static final Keyword K_CREATE_SCHEMA = keyword("create schema");
|
||||
static final Keyword K_CREATE_VIEW = keyword("create view");
|
||||
static final Keyword K_CROSS_JOIN_LATERAL = keyword("cross join lateral");
|
||||
static final Keyword K_CURRENT_SCHEMA = keyword("current_schema");
|
||||
static final Keyword K_CURRENT_ROW = keyword("current row");
|
||||
static final Keyword K_DATE = keyword("date");
|
||||
static final Keyword K_DATETIME = keyword("datetime");
|
||||
@ -242,6 +243,7 @@ final class Keywords {
|
||||
static final Keyword K_SEQUENCE = keyword("sequence");
|
||||
static final Keyword K_SERIAL = keyword("serial");
|
||||
static final Keyword K_SERIAL8 = keyword("serial8");
|
||||
static final Keyword K_SESSION = keyword("session");
|
||||
static final Keyword K_SET = keyword("set");
|
||||
static final Keyword K_SET_DATA_TYPE = keyword("set data type");
|
||||
static final Keyword K_SET_DEFAULT = keyword("set default");
|
||||
|
||||
@ -1410,7 +1410,7 @@ final class ParserImpl implements Parser {
|
||||
throw ctx.unexpectedToken();
|
||||
}
|
||||
|
||||
private static final DDLQuery parseAlter(ParserContext ctx) {
|
||||
private static final Query parseAlter(ParserContext ctx) {
|
||||
parseKeyword(ctx, "ALTER");
|
||||
|
||||
if (parseKeywordIf(ctx, "DOMAIN"))
|
||||
@ -1421,6 +1421,8 @@ final class ParserImpl implements Parser {
|
||||
return parseAlterSchema(ctx);
|
||||
else if (parseKeywordIf(ctx, "SEQUENCE"))
|
||||
return parseAlterSequence(ctx);
|
||||
else if (parseKeywordIf(ctx, "SESSION"))
|
||||
return parseAlterSession(ctx);
|
||||
else if (parseKeywordIf(ctx, "TABLE"))
|
||||
return parseAlterTable(ctx);
|
||||
else if (parseKeywordIf(ctx, "VIEW"))
|
||||
@ -1722,6 +1724,12 @@ final class ParserImpl implements Parser {
|
||||
throw ctx.unexpectedToken();
|
||||
}
|
||||
|
||||
private static final Query parseAlterSession(ParserContext ctx) {
|
||||
parseKeyword(ctx, "SET CURRENT_SCHEMA");
|
||||
parse(ctx, '=');
|
||||
return ctx.dsl.setSchema(parseSchemaName(ctx));
|
||||
}
|
||||
|
||||
private static final DDLQuery parseSetGenerator(ParserContext ctx) {
|
||||
Sequence<?> sequenceName = parseSequenceName(ctx);
|
||||
parseKeyword(ctx, "TO");
|
||||
|
||||
@ -37,7 +37,10 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.Keywords.K_ALTER;
|
||||
import static org.jooq.impl.Keywords.K_CURRENT_SCHEMA;
|
||||
import static org.jooq.impl.Keywords.K_SCHEMA;
|
||||
import static org.jooq.impl.Keywords.K_SESSION;
|
||||
import static org.jooq.impl.Keywords.K_SET;
|
||||
|
||||
import org.jooq.Clause;
|
||||
@ -62,6 +65,12 @@ final class SetSchema extends AbstractQuery {
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case H2:
|
||||
case POSTGRES:
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user