未验证 提交 849eb0a2 编写于 作者: H huolibo 提交者: GitHub

Merge pull request #8362 from taosdata/TS-336

[TS-336]<fix>:don't need return -1,when update sql done
...@@ -84,8 +84,7 @@ public class TSDBStatement extends AbstractStatement { ...@@ -84,8 +84,7 @@ public class TSDBStatement extends AbstractStatement {
long pSql = this.connection.getConnector().executeQuery(sql); long pSql = this.connection.getConnector().executeQuery(sql);
// if pSql is create/insert/update/delete/alter SQL // if pSql is create/insert/update/delete/alter SQL
if (this.connection.getConnector().isUpdateQuery(pSql)) { if (this.connection.getConnector().isUpdateQuery(pSql)) {
int rows = this.connection.getConnector().getAffectedRows(pSql); this.affectedRows = this.connection.getConnector().getAffectedRows(pSql);
this.affectedRows = rows == 0 ? -1 : this.connection.getConnector().getAffectedRows(pSql);
this.connection.getConnector().freeResultSet(pSql); this.connection.getConnector().freeResultSet(pSql);
return false; return false;
} }
......
...@@ -140,8 +140,7 @@ public class RestfulStatement extends AbstractStatement { ...@@ -140,8 +140,7 @@ public class RestfulStatement extends AbstractStatement {
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE);
JSONArray data = jsonObject.getJSONArray("data"); JSONArray data = jsonObject.getJSONArray("data");
if (data != null) { if (data != null) {
int rows = data.getJSONArray(0).getInteger(0); return data.getJSONArray(0).getInteger(0);
return rows == 0 ? -1 : data.getJSONArray(0).getInteger(0);
} }
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册