[#430] Add support for the Firebird database - Fixed INSERT .. RETURNING

This commit is contained in:
Lukas Eder 2012-08-19 17:39:40 +02:00
parent 7161ccf131
commit dfb0bfda4c
5 changed files with 20 additions and 8 deletions

View File

@ -544,9 +544,14 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T658,
// JDBC bug
case CUBRID:
case DERBY:
// TODO Firebird supports the INSERT .. RETURNING syntax, but doesn't
// support true multi-record inserts. This should be fixed in Firebird
case FIREBIRD:
case H2:
case INGRES:
case ORACLE:
// TODO [#832] Fix this. This might be a driver issue for Sybase
case SQLITE:
case SQLSERVER:

View File

@ -217,8 +217,8 @@ public interface InsertQuery<R extends Record> extends StoreQuery<R>, Insert<R>
* <p>
* This implemented differently for every dialect:
* <ul>
* <li>Postgres has native support for <code>INSERT .. RETURNING</code>
* clauses</li>
* <li>Firebird and Postgres have native support for
* <code>INSERT .. RETURNING</code> clauses</li>
* <li>HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table
* column as "generated key" in one statement</li>
* <li>Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving
@ -247,8 +247,8 @@ public interface InsertQuery<R extends Record> extends StoreQuery<R>, Insert<R>
* <p>
* This implemented differently for every dialect:
* <ul>
* <li>Postgres has native support for <code>INSERT .. RETURNING</code>
* clauses</li>
* <li>Firebird and Postgres have native support for
* <code>INSERT .. RETURNING</code> clauses</li>
* <li>HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table
* column as "generated key" in one statement</li>
* <li>Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving

View File

@ -52,7 +52,8 @@ import org.jooq.exception.DataAccessException;
* <p>
* This implemented differently for every dialect:
* <ul>
* <li>Postgres has native support for <code>INSERT .. RETURNING</code> clauses</li>
* <li>Firebird and Postgres have native support for
* <code>INSERT .. RETURNING</code> clauses</li>
* <li>HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table
* column as "generated key" in one statement</li>
* <li>Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY

View File

@ -52,7 +52,8 @@ import java.util.Collection;
* <p>
* This implemented differently for every dialect:
* <ul>
* <li>Postgres has native support for <code>INSERT .. RETURNING</code> clauses</li>
* <li>Firebird and Postgres have native support for
* <code>INSERT .. RETURNING</code> clauses</li>
* <li>HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table
* column as "generated key" in one statement</li>
* <li>Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY

View File

@ -342,6 +342,7 @@ class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> implements
if (!returning.isEmpty()) {
switch (context.getDialect()) {
case FIREBIRD:
case POSTGRES:
context.formatSeparator()
.keyword("returning ")
@ -361,6 +362,7 @@ class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> implements
.bind(updateMap);
switch (context.getDialect()) {
case FIREBIRD:
case POSTGRES:
context.bind((QueryPart) returning);
break;
@ -442,6 +444,7 @@ class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> implements
switch (ctx.getDialect()) {
// Postgres uses the RETURNING clause in SQL
case FIREBIRD:
case POSTGRES:
// SQLite will select last_insert_rowid() after the INSER
case SQLITE:
@ -547,8 +550,10 @@ class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> implements
}
}
// Postgres can execute the INSERT .. RETURNING clause like
// a select clause. JDBC support is not implemented
// Firebird and Postgres can execute the INSERT .. RETURNING
// clause like a select clause. JDBC support is not implemented
// in the Postgres JDBC driver
case FIREBIRD:
case POSTGRES: {
listener.executeStart(ctx);
rs = ctx.statement().executeQuery();