Check operationType instead of the first SQL token
parent
fd28841b1d
commit
ffe4c58d86
|
@ -611,7 +611,10 @@ public class OutboundMessageProcessor implements Runnable {
|
||||||
"DBBC_E00627");
|
"DBBC_E00627");
|
||||||
throw new Exception(faultString, e);
|
throw new Exception(faultString, e);
|
||||||
}
|
}
|
||||||
if (isSelectStatement(sql)) {
|
if (meta.getJDBCOperationInput().getOperationType().
|
||||||
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_SELECT.toString()) ||
|
||||||
|
meta.getJDBCOperationInput().getOperationType().
|
||||||
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) {
|
||||||
try {
|
try {
|
||||||
rs = executeOutboundSQLSelect(inMsg, epb, meta,
|
rs = executeOutboundSQLSelect(inMsg, epb, meta,
|
||||||
connection);
|
connection);
|
||||||
|
@ -691,8 +694,9 @@ public class OutboundMessageProcessor implements Runnable {
|
||||||
*/
|
*/
|
||||||
String generatedKey = meta.getJDBCSql().
|
String generatedKey = meta.getJDBCSql().
|
||||||
getGeneratedKey();
|
getGeneratedKey();
|
||||||
if (isInsertStatement(sql) && generatedKey != null && !"".equals(
|
if (meta.getJDBCOperationInput().getOperationType().
|
||||||
generatedKey)) {
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) &&
|
||||||
|
generatedKey != null && !"".equals(generatedKey)) {
|
||||||
generatedKeyValue =
|
generatedKeyValue =
|
||||||
executeOutboundSQLWithGeneratedKeys(
|
executeOutboundSQLWithGeneratedKeys(
|
||||||
inMsg, epb, meta, connection);
|
inMsg, epb, meta, connection);
|
||||||
|
@ -1133,7 +1137,10 @@ public class OutboundMessageProcessor implements Runnable {
|
||||||
transaction.enlistResource(xaresource);
|
transaction.enlistResource(xaresource);
|
||||||
connection = xaconnection.getConnection();*/
|
connection = xaconnection.getConnection();*/
|
||||||
|
|
||||||
if (isSelectStatement(sql)) {
|
if (meta.getJDBCOperationInput().getOperationType().
|
||||||
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_SELECT.toString()) ||
|
||||||
|
meta.getJDBCOperationInput().getOperationType().
|
||||||
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) {
|
||||||
try {
|
try {
|
||||||
rs = executeOutboundSQLSelect(inMsg, epb, meta,
|
rs = executeOutboundSQLSelect(inMsg, epb, meta,
|
||||||
connection);
|
connection);
|
||||||
|
@ -1301,8 +1308,9 @@ public class OutboundMessageProcessor implements Runnable {
|
||||||
*/
|
*/
|
||||||
String generatedKey = meta.getJDBCSql().
|
String generatedKey = meta.getJDBCSql().
|
||||||
getGeneratedKey();
|
getGeneratedKey();
|
||||||
if (isInsertStatement(sql) && generatedKey != null && !"".
|
if (meta.getJDBCOperationInput().getOperationType().
|
||||||
equals(generatedKey)) {
|
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) &&
|
||||||
|
generatedKey != null && !"".equals(generatedKey)) {
|
||||||
generatedKeyValue =
|
generatedKeyValue =
|
||||||
executeOutboundSQLWithGeneratedKeys(
|
executeOutboundSQLWithGeneratedKeys(
|
||||||
inMsg, epb, meta, connection);
|
inMsg, epb, meta, connection);
|
||||||
|
@ -2100,47 +2108,6 @@ public class OutboundMessageProcessor implements Runnable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param prepStmtSQLText
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isSelectStatement(final String prepStmtSQLText) {
|
|
||||||
prepStmtSQLText.trim();
|
|
||||||
|
|
||||||
final StringTokenizer tok = new StringTokenizer(prepStmtSQLText);
|
|
||||||
|
|
||||||
if (tok.hasMoreTokens()) {
|
|
||||||
final String firstTok = (String) tok.nextToken();
|
|
||||||
|
|
||||||
if (firstTok.equalsIgnoreCase("select"))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by Logicoy for [ task #20 ] DB BC - Insert statement should return primary key auto-increment value inserted
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @param prepStmtSQLText
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isInsertStatement(final String prepStmtSQLText) {
|
|
||||||
prepStmtSQLText.trim();
|
|
||||||
|
|
||||||
final StringTokenizer tok = new StringTokenizer(prepStmtSQLText);
|
|
||||||
|
|
||||||
if (tok.hasMoreTokens()) {
|
|
||||||
final String firstTok = (String) tok.nextToken();
|
|
||||||
|
|
||||||
if (firstTok.equalsIgnoreCase("insert"))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TransactionManager getTransactionManager() {
|
private TransactionManager getTransactionManager() {
|
||||||
return (TransactionManager) mContext.getContext().getTransactionManager();
|
return (TransactionManager) mContext.getContext().getTransactionManager();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue