parent
b7f6c21655
commit
c2ff3dfd10
@ -30,6 +30,7 @@ ddlStatement =
|
||||
| setCatalogStatement
|
||||
| setSchemaStatement
|
||||
| truncateStatement
|
||||
| useStatement
|
||||
;
|
||||
|
||||
dmlStatement =
|
||||
@ -173,6 +174,9 @@ setCatalogStatement = 'SET CATALOG' catalogName
|
||||
setSchemaStatement = 'SET SCHEMA' schemaName
|
||||
;
|
||||
|
||||
useStatement = 'USE' ( catalogName | schemaName )
|
||||
;
|
||||
|
||||
truncateStatement = 'TRUNCATE TABLE' tableName [ 'CONTINUE IDENTITY' | 'RESTART IDENTITY' ] [ 'CASCADE' | 'RESTRICT' ]
|
||||
;
|
||||
|
||||
|
||||
@ -8461,31 +8461,27 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
// XXX Session Statements
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set the current catalog to a new value.
|
||||
*
|
||||
* @see DSL#catalog(Name)
|
||||
*/
|
||||
@Support({})
|
||||
Query setCatalog(String catalog);
|
||||
|
||||
/**
|
||||
* Set the current catalog to a new value.
|
||||
*
|
||||
* @see DSL#catalog(Name)
|
||||
*/
|
||||
@Support({})
|
||||
Query setCatalog(Name catalog);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the current catalog to a new value.
|
||||
*/
|
||||
@Support({})
|
||||
Query setCatalog(Catalog catalog);
|
||||
|
||||
/**
|
||||
* Set the current schema to a new value.
|
||||
|
||||
@ -2871,24 +2871,20 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
// XXX DDL Statements
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Query setCatalog(String catalog) {
|
||||
return setCatalog(name(catalog));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query setCatalog(Name catalog) {
|
||||
return setCatalog(catalog(catalog));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Query setCatalog(Catalog catalog) {
|
||||
return new SetCatalog(configuration(), catalog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query setSchema(String schema) {
|
||||
|
||||
@ -599,6 +599,8 @@ final class ParserImpl implements Parser {
|
||||
case 'U':
|
||||
if (!resultQuery && peekKeyword(ctx, "UPDATE"))
|
||||
return parseUpdate(ctx);
|
||||
else if (!resultQuery && peekKeyword(ctx, "USE"))
|
||||
return parseUse(ctx);
|
||||
|
||||
break;
|
||||
|
||||
@ -1245,12 +1247,9 @@ final class ParserImpl implements Parser {
|
||||
private static final Query parseSet(ParserContext ctx) {
|
||||
parseKeyword(ctx, "SET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (parseKeywordIf(ctx, "GENERATOR"))
|
||||
if (parseKeywordIf(ctx, "CATALOG"))
|
||||
return parseSetCatalog(ctx);
|
||||
else if (parseKeywordIf(ctx, "GENERATOR"))
|
||||
return parseSetGenerator(ctx);
|
||||
else if (parseKeywordIf(ctx, "SCHEMA"))
|
||||
return parseSetSchema(ctx);
|
||||
@ -1262,11 +1261,14 @@ final class ParserImpl implements Parser {
|
||||
return IGNORE_NO_DELIMITER;
|
||||
}
|
||||
|
||||
private static final Query parseSetCatalog(ParserContext ctx) {
|
||||
return ctx.dsl.setCatalog(parseCatalogName(ctx));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static final Query parseUse(ParserContext ctx) {
|
||||
parseKeyword(ctx, "USE");
|
||||
return ctx.dsl.setCatalog(parseCatalogName(ctx));
|
||||
}
|
||||
|
||||
private static final Query parseSetSchema(ParserContext ctx) {
|
||||
return ctx.dsl.setSchema(parseSchemaName(ctx));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user