Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
TRAFODION-2957 one stmt support multi-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
aven committed Apr 24, 2018
1 parent c826bce commit 0cdb4ca
Show file tree
Hide file tree
Showing 6 changed files with 777 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ public class T4Properties {
//TCP Nagle's algorithm
private boolean _tcpNoDelay = true;

private boolean allowMultiQueries = false;

// -----------------------------------------------------------
//
// The following static members and static block are ment to
Expand Down Expand Up @@ -436,9 +438,10 @@ private void setProperties() {

setLobChunkSize(getProperty("lobChunkSize"));
setUseLobHandle(getProperty("useLobHandle"));
setAllowMultiQueries(getProperty("allowMultiQueries"));
}

T4Properties getT4Properties() {
T4Properties getT4Properties() {
return this;
}

Expand Down Expand Up @@ -532,6 +535,7 @@ public Properties getProperties() {
props.setProperty("lobChunkSize", String.valueOf(lobChunkSize_));
props.setProperty("useLobHandle", String.valueOf(useLobHandle_));

props.setProperty("allowMultiQueries", String.valueOf(allowMultiQueries));
return props;
}

Expand Down Expand Up @@ -1942,19 +1946,19 @@ public void setUseLobHandle(String val) {

/**
* Returns the rounding mode set for the driver as an Integer value with one
* of the following values. static int ROUND_CEILING Rounding mode to round
* towards positive infinity. static int ROUND_DOWN Rounding mode to round
* towards zero. static int ROUND_FLOOR Rounding mode to round towards
* negative infinity. static int ROUND_HALF_DOWN Rounding mode to round
* towards "nearest neighbor" unless both neighbors are equidistant, in
* which case round down. static int ROUND_HALF_EVEN Rounding mode to round
* towards the "nearest neighbor" unless both neighbors are equidistant, in
* which case, round towards the even neighbor. static int ROUND_HALF_UP
* Rounding mode to round towards "nearest neighbor" unless both neighbors
* are equidistant, in which case round up. static int ROUND_UNNECESSARY
* Rounding mode to assert that the requested operation has an exact result,
* hence no rounding is necessary. static int ROUND_UP Rounding mode to
* round away from zero.
* of the following values.
* static int ROUND_CEILING Rounding mode to round towards positive infinity.
* static int ROUND_DOWN Rounding mode to round towards zero.
* static int ROUND_FLOOR Rounding mode to round towards negative infinity.
* static int ROUND_HALF_DOWN Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round down.
* static int ROUND_HALF_EVEN Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
* in which case, round towards the even neighbor.
* static int ROUND_HALF_UP Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round up.
* static int ROUND_UNNECESSARY Rounding mode to assert that the requested operation has an exact result,
* hence no rounding is necessary.
* static int ROUND_UP Rounding mode to round away from zero.
*/
int getRoundingMode() {
return roundMode_;
Expand Down Expand Up @@ -2571,6 +2575,20 @@ void setClientInfoProperties(Properties prop) {
Properties getClientInfoProperties() {
return this.clientInfoProp;
}



public boolean isAllowMultiQueries() {
return allowMultiQueries;
}

public void setAllowMultiQueries(boolean allowMultiQueries) {
this.allowMultiQueries = allowMultiQueries;
}

private void setAllowMultiQueries(String property) {
if (property != null && property.length()>0){
setAllowMultiQueries(Boolean.valueOf(property));
}else{
setAllowMultiQueries(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ public Statement createStatement() throws SQLException {
validateConnection();

try {
return new TrafT4Statement(this);
if (props_.isAllowMultiQueries()) {
return new TrafT4MultiQueriesStatement(this);
} else {
return new TrafT4Statement(this);
}
} catch (SQLException se) {
performConnectionErrorChecks(se);
throw se;
Expand Down Expand Up @@ -774,9 +778,12 @@ public PreparedStatement prepareStatement(String sql) throws SQLException {
}
}

stmt = new TrafT4PreparedStatement(this, sql);

stmt.prepare(stmt.sql_, stmt.queryTimeout_, stmt.resultSetHoldability_);
if (props_.isAllowMultiQueries()) {
stmt = new TrafT4MultiQueriesPreparedStatement(this, sql);
} else {
stmt = new TrafT4PreparedStatement(this, sql);
stmt.prepare(stmt.sql_, stmt.queryTimeout_, stmt.resultSetHoldability_);
}

if (isStatementCachingEnabled()) {
addPreparedStatement(this, sql, stmt, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
Expand Down
Loading

0 comments on commit 0cdb4ca

Please sign in to comment.