diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/SchemaAndMappingTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/SchemaAndMappingTests.java index fcbb76bc6f..d3005b0f95 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/SchemaAndMappingTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/SchemaAndMappingTests.java @@ -40,14 +40,11 @@ import static java.util.Collections.nCopies; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; -import static org.jooq.impl.DSL.count; import static org.jooq.impl.DSL.sum; import java.math.BigDecimal; import java.sql.Date; -import java.util.Arrays; -import org.jooq.DSLContext; import org.jooq.Field; import org.jooq.Record; import org.jooq.Record1; @@ -94,39 +91,6 @@ extends BaseTest result = - factory.select(TBook_AUTHOR_ID(), count()) - .from(TBook()) - .join(TAuthor()) - .on(TBook_AUTHOR_ID().equal(TAuthor_ID())) - .where(TAuthor_YEAR_OF_BIRTH().greaterOrEqual(TAuthor_ID())) - .groupBy(TBook_AUTHOR_ID()) - .having(count().greaterOrEqual(1)) - .orderBy(TBook_AUTHOR_ID().desc()) - .fetch(); - - assertEquals(Arrays.asList(2, 1), result.getValues(TBook_AUTHOR_ID())); - assertEquals(Arrays.asList(2, 2), result.getValues(count())); - - String sql = factory.select(TBook_AUTHOR_ID()).from(TAuthor()).getSQL(); - assertFalse(sql.toLowerCase().contains(TAuthor().getSchema().getName().toLowerCase())); - } - @Test public void testTableMapping() throws Exception { Settings settings = new Settings() diff --git a/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java b/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java index cdc500045f..d39c99d511 100644 --- a/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java +++ b/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java @@ -904,19 +904,11 @@ public abstract class jOOQAbstractTest< return ""; } - // IMPORTANT! Make this the first test, to prevent side-effects @Test public void testInsertIdentity() throws Exception { new InsertUpdateTests(this).testInsertIdentity(); } - - // IMPORTANT! Make this the an early test, to check for attaching side-effects - @Test - public void testUse() throws Exception { - new SchemaAndMappingTests(this).testUse(); - } - @Test public void testTableMapping() throws Exception { new SchemaAndMappingTests(this).testTableMapping(); diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java index 3de3015ee8..892c9b795b 100644 --- a/jOOQ/src/main/java/org/jooq/DSLContext.java +++ b/jOOQ/src/main/java/org/jooq/DSLContext.java @@ -4285,72 +4285,6 @@ public interface DSLContext { @Support({ CUBRID, DB2, FIREBIRD, H2, INGRES, ORACLE, POSTGRES, SYBASE }) T currval(Sequence sequence) throws DataAccessException; - /** - * Use a schema as the default schema of the underlying connection. - *

- * This has two effects. - *

    - *
  1. The USE [schema] statement is executed on those RDBMS - * that support this
  2. - *
  3. The supplied {@link Schema} is used as the default schema resulting - * in omitting that schema in rendered SQL.
  4. - *
- *

- * The USE [schema] statement translates to the various - * dialects as follows: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
DialectCommand
DB2SET SCHEMA [schema]
Derby:SET SCHEMA [schema]
H2:SET SCHEMA [schema]
HSQLDB:SET SCHEMA [schema]
MySQL:USE [schema]
Oracle:ALTER SESSION SET CURRENT_SCHEMA = [schema]
Postgres:SET SEARCH_PATH = [schema]
Sybase:USE [schema]
- * - * @throws DataAccessException if something went wrong executing the query - */ - @Support({ DB2, DERBY, H2, HSQLDB, MYSQL, SYBASE, ORACLE, POSTGRES, SYBASE }) - int use(Schema schema) throws DataAccessException; - - /** - * Use a schema as the default schema of the underlying connection. - * - * @see #use(Schema) - * @throws DataAccessException if something went wrong executing the query - */ - @Support({ DB2, DERBY, H2, HSQLDB, MYSQL, SYBASE, ORACLE, POSTGRES, SYBASE }) - int use(String schema) throws DataAccessException; - // ------------------------------------------------------------------------- // XXX Global Record factory // ------------------------------------------------------------------------- diff --git a/jOOQ/src/main/java/org/jooq/impl/DSLContextImpl.java b/jOOQ/src/main/java/org/jooq/impl/DSLContextImpl.java index 9e8e96ee23..b1af28df8c 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSLContextImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSLContextImpl.java @@ -50,7 +50,6 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.SQLITE; import static org.jooq.SQLDialect.SQLSERVER; import static org.jooq.SQLDialect.SYBASE; -import static org.jooq.conf.SettingsTools.getRenderMapping; import static org.jooq.impl.DSL.field; import static org.jooq.impl.DSL.fieldByName; import static org.jooq.impl.DSL.trueCondition; @@ -1494,62 +1493,6 @@ class DSLContextImpl implements DSLContext, Serializable { return select(currval).fetchOne(currval); } - @Override - @SuppressWarnings("deprecation") - @Support({ DB2, DERBY, H2, HSQLDB, MYSQL, SYBASE, ORACLE, POSTGRES, SYBASE }) - public final int use(Schema schema) throws DataAccessException { - int result = 0; - - try { - String schemaName = render(schema); - - switch (configuration.dialect()) { - case DB2: - case DERBY: - case H2: - case HSQLDB: - result = query("set schema " + schemaName).execute(); - break; - - case ASE: - case MYSQL: - case SYBASE: - result = query("use " + schemaName).execute(); - break; - - case ORACLE: - result = query("alter session set current_schema = " + schemaName).execute(); - break; - - case POSTGRES: - result = query("set search_path = " + schemaName).execute(); - break; - - // SQL Server do not support such a syntax for selecting - // schemata, only for selecting databases - case SQLSERVER: - break; - - // CUBRID and SQLite don't have any schemata - case CUBRID: - case SQLITE: - break; - } - } - finally { - getRenderMapping(configuration.settings()).setDefaultSchema(schema.getName()); - configuration.schemaMapping().use(schema); - } - - return result; - } - - @Override - @Support({ DB2, DERBY, H2, HSQLDB, MYSQL, SYBASE, ORACLE, POSTGRES, SYBASE }) - public final int use(String schema) throws DataAccessException { - return use(new SchemaImpl(schema)); - } - // ------------------------------------------------------------------------- // XXX Global Record factory // -------------------------------------------------------------------------