Skip to content

Commit

Permalink
changes to get firebird sequences working
Browse files Browse the repository at this point in the history
(prefix of "gen_" instead of suffix of "_seq")
  • Loading branch information
erilong committed Mar 25, 2008
1 parent d3c7ea1 commit ddfb4bd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
Expand Up @@ -99,8 +99,7 @@ public String getTransactionTriggerExpression() {
}

public String getSelectLastInsertIdSql(String sequenceName) {
//return "select currval('" + sequenceName + "')";
return null;
return "select gen_id(gen_" + sequenceName + ", 1) from rdb$database";
}

public boolean isCharSpacePadded() {
Expand All @@ -120,7 +119,7 @@ public boolean supportsMixedCaseNamesInCatalog() {
}

protected boolean allowsNullForIdentityColumn() {
return true;
return false;
}

public void purge() {
Expand Down
Expand Up @@ -104,7 +104,7 @@ public boolean supportsTransactionId() {
}

public String getSelectLastInsertIdSql(String sequenceName) {
return "select " + sequenceName + ".currval from dual')";
return "select " + sequenceName + "_seq.currval from dual')";
}

@Override
Expand Down
Expand Up @@ -108,7 +108,7 @@ public String getTransactionTriggerExpression() {
}

public String getSelectLastInsertIdSql(String sequenceName) {
return "select currval('" + sequenceName + "')";
return "select currval('" + sequenceName + "_seq')";
}

public boolean requiresSavepointForFallback() {
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void insertCreateEvent(final Node targetNode, final Trigger trigger, Stri
}

public long insertData(final Data data) {
return dbDialect.insertWithGeneratedKey(insertIntoDataSql, "sym_data_data_id_seq",
return dbDialect.insertWithGeneratedKey(insertIntoDataSql, "sym_data_data_id",
new PreparedStatementCallback() {
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException,
DataAccessException {
Expand Down
Expand Up @@ -192,7 +192,7 @@ public Object doInConnection(Connection conn) throws SQLException, DataAccessExc
}

public void insertOutgoingBatch(final OutgoingBatch outgoingBatch) {
long batchId = dbDialect.insertWithGeneratedKey(createBatchSql, "sym_outgoing_batch_batch_id_seq",
long batchId = dbDialect.insertWithGeneratedKey(createBatchSql, "sym_outgoing_batch_batch_id",
new PreparedStatementCallback() {
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
ps.setString(1, outgoingBatch.getNodeId());
Expand Down

0 comments on commit ddfb4bd

Please sign in to comment.