Subject | getUpdateCount Problem |
---|---|
Author | Gonzalo Odiard |
Post date | 2004-12-16T17:08Z |
We have a problem with an application in a JBoss, this is using
firebirdsql.rar 1.0.0
Trying to resolve this, we have changed to version 1.5.5 but have the
following problem:
Our application make a massive importation.
We make a update and if getUpdateCount <= 0 make a insert. We are
reusing PreparedStatements.
This work in version 1.0.0, but in 1.5.5 not, (getUpdateCout returns -1)
We have modified AbstractStatement. getUpdateCount() and its working,
but we don t know if there are another situation when this is not correct.
public int getUpdateCount() throws SQLException {
// if (isResultSet || !hasMoreResults) { // we changed
this line
if (isResultSet) {
return -1;
}
else {
try {
c.getSqlCounts(fixedStmt);
int insCount = fixedStmt.getInsertCount();
int updCount = fixedStmt.getUpdateCount();
int delCount = fixedStmt.getDeleteCount();
int resCount = ((updCount>delCount) ? updCount:delCount);
resCount = ((resCount>insCount) ? resCount:insCount);
return resCount;
}
catch (GDSException ge) {
throw new FBSQLException(ge);
} finally {
hasMoreResults = false;
}
}
}
firebirdsql.rar 1.0.0
Trying to resolve this, we have changed to version 1.5.5 but have the
following problem:
Our application make a massive importation.
We make a update and if getUpdateCount <= 0 make a insert. We are
reusing PreparedStatements.
This work in version 1.0.0, but in 1.5.5 not, (getUpdateCout returns -1)
We have modified AbstractStatement. getUpdateCount() and its working,
but we don t know if there are another situation when this is not correct.
public int getUpdateCount() throws SQLException {
// if (isResultSet || !hasMoreResults) { // we changed
this line
if (isResultSet) {
return -1;
}
else {
try {
c.getSqlCounts(fixedStmt);
int insCount = fixedStmt.getInsertCount();
int updCount = fixedStmt.getUpdateCount();
int delCount = fixedStmt.getDeleteCount();
int resCount = ((updCount>delCount) ? updCount:delCount);
resCount = ((resCount>insCount) ? resCount:insCount);
return resCount;
}
catch (GDSException ge) {
throw new FBSQLException(ge);
} finally {
hasMoreResults = false;
}
}
}