提交 fee9f740 编写于 作者: H Haojun Liao

fix jdbc memory leaks. #3098

上级 c9608580
...@@ -33,6 +33,7 @@ public class TSDBStatement implements Statement { ...@@ -33,6 +33,7 @@ public class TSDBStatement implements Statement {
* Status of current statement * Status of current statement
*/ */
private boolean isClosed = true; private boolean isClosed = true;
private int affectedRows = 0;
TSDBStatement(TSDBJNIConnector connecter) { TSDBStatement(TSDBJNIConnector connecter) {
this.connecter = connecter; this.connecter = connecter;
...@@ -91,9 +92,10 @@ public class TSDBStatement implements Statement { ...@@ -91,9 +92,10 @@ public class TSDBStatement implements Statement {
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL));
} }
int num = this.connecter.getAffectedRows(pSql); this.affectedRows = this.connecter.getAffectedRows(pSql);
this.connecter.freeResultSet(pSql); this.connecter.freeResultSet(pSql);
return num;
return this.affectedRows;
} }
public String getErrorMsg(long pSql) { public String getErrorMsg(long pSql) {
...@@ -190,7 +192,8 @@ public class TSDBStatement implements Statement { ...@@ -190,7 +192,8 @@ public class TSDBStatement implements Statement {
if (isClosed) { if (isClosed) {
throw new SQLException("Invalid method call on a closed statement."); throw new SQLException("Invalid method call on a closed statement.");
} }
return this.connecter.getAffectedRows(this.pSql);
return this.affectedRows;
} }
public boolean getMoreResults() throws SQLException { public boolean getMoreResults() throws SQLException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册