Permalink
Browse files

refactor: remove obsolete outParmBeforeFunc (#1234)

  • Loading branch information...
benbenw authored and vlsi committed Jul 1, 2018
1 parent 83f2e38 commit 71028532bcbc36e8239a4a7f9ad87e1acd070dc9
@@ -18,18 +18,16 @@
public final Object key;
public final Query query;
public final boolean isFunction;
public final boolean outParmBeforeFunc;
private int executeCount;
public CachedQuery(Object key, Query query, boolean isFunction, boolean outParmBeforeFunc) {
public CachedQuery(Object key, Query query, boolean isFunction) {
assert key instanceof String || key instanceof CanEstimateSize
: "CachedQuery.key should either be String or implement CanEstimateSize."
+ " Actual class is " + key.getClass();
this.key = key;
this.query = query;
this.isFunction = isFunction;
this.outParmBeforeFunc = outParmBeforeFunc;
}
public void increaseExecuteCount() {
@@ -72,7 +70,6 @@ public String toString() {
+ "executeCount=" + executeCount
+ ", query=" + query
+ ", isFunction=" + isFunction
+ ", outParmBeforeFunc=" + outParmBeforeFunc
+ '}';
}
}
@@ -41,17 +41,14 @@ public CachedQuery create(Object key) throws SQLException {
Parser.replaceProcessing(parsedSql, true, queryExecutor.getStandardConformingStrings());
}
boolean isFunction;
boolean outParmBeforeFunc;
if (key instanceof CallableQueryKey) {
JdbcCallParseInfo callInfo =
Parser.modifyJdbcCall(parsedSql, queryExecutor.getStandardConformingStrings(),
queryExecutor.getServerVersionNum(), queryExecutor.getProtocolVersion());
parsedSql = callInfo.getSql();
isFunction = callInfo.isFunction();
outParmBeforeFunc = callInfo.isOutParmBeforeFunc();
} else {
isFunction = false;
outParmBeforeFunc = false;
}
boolean isParameterized = key instanceof String || queryKey.isParameterized;
boolean splitStatements = isParameterized || queryExecutor.getPreferQueryMode().compareTo(PreferQueryMode.EXTENDED) >= 0;
@@ -68,6 +65,6 @@ public CachedQuery create(Object key) throws SQLException {
queryExecutor.isReWriteBatchedInsertsEnabled(), returningColumns);
Query query = queryExecutor.wrap(queries);
return new CachedQuery(key, query, isFunction, outParmBeforeFunc);
return new CachedQuery(key, query, isFunction);
}
}
@@ -11,12 +11,10 @@
public class JdbcCallParseInfo {
private final String sql;
private final boolean isFunction;
private final boolean outParmBeforeFunc;
public JdbcCallParseInfo(String sql, boolean isFunction, boolean outParmBeforeFunc) {
public JdbcCallParseInfo(String sql, boolean isFunction) {
this.sql = sql;
this.isFunction = isFunction;
this.outParmBeforeFunc = outParmBeforeFunc;
}
/**
@@ -37,12 +35,4 @@ public boolean isFunction() {
return isFunction;
}
/**
* Returns if given SQL is a function with one out parameter
*
* @return true if given SQL is a function with one out parameter
*/
public boolean isOutParmBeforeFunc() {
return outParmBeforeFunc;
}
}
@@ -994,7 +994,7 @@ public static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdString
if (i == len && !syntaxError) {
if (state == 1) {
// Not an escaped syntax.
return new JdbcCallParseInfo(sql, isFunction, outParmBeforeFunc);
return new JdbcCallParseInfo(sql, isFunction);
}
if (state != 8) {
syntaxError = true; // Ran out of query while still parsing
@@ -1009,7 +1009,7 @@ public static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdString
if (serverVersion < 80100 /* 8.1 */ || protocolVersion != 3) {
sql = "select " + jdbcSql.substring(startIndex, endIndex) + " as result";
return new JdbcCallParseInfo(sql, isFunction, outParmBeforeFunc);
return new JdbcCallParseInfo(sql, isFunction);
}
String s = jdbcSql.substring(startIndex, endIndex);
StringBuilder sb = new StringBuilder(s);
@@ -1036,7 +1036,7 @@ public static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdString
}
}
sql = "select * from " + sb.toString() + " as result";
return new JdbcCallParseInfo(sql, isFunction, outParmBeforeFunc);
return new JdbcCallParseInfo(sql, isFunction);
}
/**
@@ -48,7 +48,6 @@
int rsHoldability) throws SQLException {
super(connection, connection.borrowCallableQuery(sql), rsType, rsConcurrency, rsHoldability);
this.isFunction = preparedQuery.isFunction;
this.outParmBeforeFunc = preparedQuery.outParmBeforeFunc;
if (this.isFunction) {
int inParamCount = this.preparedParameters.getInParameterCount() + 1;
@@ -78,11 +78,6 @@
*/
protected boolean adjustIndex = false;
/*
* Used to set adjustIndex above
*/
protected boolean outParmBeforeFunc = false;
private TimeZone defaultTimeZone;
PgPreparedStatement(PgConnection connection, String sql, int rsType, int rsConcurrency,

0 comments on commit 7102853

Please sign in to comment.