[#1288] SQL syntax errors from sequences when using RenderMapping's defaultSchema
This commit is contained in:
parent
d756423efa
commit
2f568eb7e3
20
jOOQ-test/launch/jOOQOracleTest (default schema).launch
Normal file
20
jOOQ-test/launch/jOOQOracleTest (default schema).launch
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/jOOQ-test/src/org/jooq/test/jOOQOracleTest.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jooq.test.jOOQOracleTest"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jOOQ-test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djdbc.properties=/org/jooq/configuration/${env_var:USERNAME}/oracle/library.properties -Dorg.jooq.settings.defaultSchema=TEST"/>
|
||||
</launchConfiguration>
|
||||
@ -697,9 +697,11 @@ public abstract class jOOQAbstractTest<
|
||||
}
|
||||
|
||||
protected final Factory create() {
|
||||
String defaultSchema = System.getProperty("org.jooq.settings.defaultSchema", "");
|
||||
|
||||
Settings settings = SettingsTools.defaultSettings()
|
||||
.withRenderMapping(new RenderMapping()
|
||||
.withDefaultSchema(""))
|
||||
.withDefaultSchema(defaultSchema))
|
||||
.withExecuteListeners(
|
||||
TestStatisticsListener.class.getName(),
|
||||
DebugListener.class.getName());
|
||||
|
||||
@ -41,6 +41,7 @@ import static org.jooq.impl.Factory.field;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.RenderContext;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.exception.SQLDialectNotSupportedException;
|
||||
|
||||
/**
|
||||
@ -73,7 +74,7 @@ class SequenceFunction<T extends Number> extends AbstractFunction<T> {
|
||||
String field = getQualifiedName(configuration) + "." + method;
|
||||
return field(field, getDataType());
|
||||
}
|
||||
|
||||
|
||||
case H2:
|
||||
case POSTGRES: {
|
||||
String field = method + "('" + getQualifiedName(configuration) + "')";
|
||||
@ -114,9 +115,10 @@ class SequenceFunction<T extends Number> extends AbstractFunction<T> {
|
||||
|
||||
private final String getQualifiedName(Configuration configuration) {
|
||||
RenderContext local = create(configuration).renderContext();
|
||||
Schema mappedSchema = Util.getMappedSchema(configuration, sequence.schema);
|
||||
|
||||
if (sequence.schema != null && configuration.getDialect() != CUBRID) {
|
||||
local.sql(Util.getMappedSchema(configuration, sequence.schema));
|
||||
if (mappedSchema != null && configuration.getDialect() != CUBRID) {
|
||||
local.sql(mappedSchema);
|
||||
local.sql(".");
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user