[#7087] Support USE for SET SCHEMA and SET CATALOG in MySQL

This commit is contained in:
lukaseder 2018-01-25 16:17:55 +01:00
parent c2ff3dfd10
commit cbfd3bb6ee
4 changed files with 44 additions and 40 deletions

View File

@ -8466,7 +8466,7 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @see DSL#catalog(Name)
*/
@Support({})
@Support({ MARIADB, MYSQL })
Query setCatalog(String catalog);
/**
@ -8474,13 +8474,13 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @see DSL#catalog(Name)
*/
@Support({})
@Support({ MARIADB, MYSQL })
Query setCatalog(Name catalog);
/**
* Set the current catalog to a new value.
*/
@Support({})
@Support({ MARIADB, MYSQL })
Query setCatalog(Catalog catalog);
/**
@ -8488,7 +8488,7 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @see DSL#schema(Name)
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
Query setSchema(String schema);
/**
@ -8496,13 +8496,13 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @see DSL#schema(Name)
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
Query setSchema(Name schema);
/**
* Set the current schema to a new value.
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
Query setSchema(Schema schema);
// -------------------------------------------------------------------------

View File

@ -6615,44 +6615,40 @@ public class DSL {
// XXX Session Statements
// -------------------------------------------------------------------------
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@Support({ MARIADB, MYSQL })
public static Query setCatalog(String catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@Support({ MARIADB, MYSQL })
public static Query setCatalog(Name catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current catalog to a new value.
*/
@Support({ MARIADB, MYSQL })
public static Query setCatalog(Catalog catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current schema to a new value.
*
* @see DSL#schema(Name)
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
public static Query setSchema(String schema) {
return dsl().setSchema(schema);
}
@ -6662,7 +6658,7 @@ public class DSL {
*
* @see DSL#schema(Name)
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
public static Query setSchema(Name schema) {
return dsl().setSchema(schema);
}
@ -6670,7 +6666,7 @@ public class DSL {
/**
* Set the current schema to a new value.
*/
@Support({ H2, POSTGRES} )
@Support({ H2, MARIADB, MYSQL, POSTGRES} )
public static Query setSchema(Schema schema) {
return dsl().setSchema(schema);
}

View File

@ -66,8 +66,10 @@ final class SetCatalog extends AbstractQuery {
case MARIADB:
case MYSQL:
ctx.visit(K_USE).sql(' ').visit(catalog);
break;
default:
ctx.visit(K_SET).sql(' ').visit(K_CATALOG).sql(' ').visit(catalog);

View File

@ -42,6 +42,7 @@ 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 static org.jooq.impl.Keywords.K_USE;
import org.jooq.Clause;
import org.jooq.Configuration;
@ -71,6 +72,11 @@ final class SetSchema extends AbstractQuery {
case MARIADB:
case MYSQL:
ctx.visit(K_USE).sql(' ').visit(schema);
break;
case H2:
case POSTGRES:
default: