[#1257] Add CUBRID support - Fixed sequence generation

[#1257] Add CUBRID support - Fixed dual simulation
This commit is contained in:
Lukas Eder 2012-04-01 08:45:19 +00:00
parent e4775d036e
commit 5c5317ea24
3 changed files with 10 additions and 4 deletions

View File

@ -37,6 +37,7 @@
package org.jooq.util.cubrid;
import static org.jooq.impl.Factory.concat;
import static org.jooq.impl.Factory.field;
import static org.jooq.impl.Factory.val;
import static org.jooq.util.cubrid.dba.Tables.DB_CLASS;
import static org.jooq.util.cubrid.dba.Tables.DB_INDEX;
@ -163,12 +164,13 @@ public class CUBRIDDatabase extends AbstractDatabase {
for (Record record : create()
.select(
DB_SERIAL.NAME,
DB_SERIAL.MAX_VAL)
DB_SERIAL.MAX_VAL,
field("owner.name", String.class).as("owner"))
.from(DB_SERIAL)
.where(field("owner.name", String.class).in(getInputSchemata()))
.fetch()) {
// TODO: How to join DB_SERIAL.OWNER?
SchemaDefinition schema = getSchema(getInputSchemata().get(0));
SchemaDefinition schema = getSchema(record.getValue("owner", String.class));
BigInteger value = record.getValue(DB_SERIAL.MAX_VAL, BigInteger.class, BigInteger.valueOf(Long.MAX_VALUE));
DataTypeDefinition type = getDataTypeForMAX_VAL(schema, value);

View File

@ -26,6 +26,7 @@
<classpathentry exported="true" kind="lib" path="lib/iijdbc.jar"/>
<classpathentry exported="true" kind="lib" path="lib/h2-1.3.163.jar" sourcepath="/jOOQ-sources/h2-1.3.163-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/rsyntaxtextarea-1.5.0.jar"/>
<classpathentry kind="lib" path="lib/JDBC-8.4.1.1018-cubrid.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/jOOQ-console"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -82,9 +82,12 @@ class Dual extends AbstractTable<Record> {
.literal("SYSTEM_USERS");
break;
case CUBRID:
context.literal("db_root");
break;
// These dialects don't have a DUAL table. But simulation is needed
// for queries like SELECT 1 WHERE 1 = 1
case CUBRID:
case INGRES:
context.keyword("(select 1 as dual) as dual");
break;