未验证 提交 41c28f7a 编写于 作者: S slguan 提交者: GitHub

Merge pull request #701 from taosdata/feature/liaohj

[TBASE-1099] fix bug referred in issue #699, refactor some codes
......@@ -479,6 +479,7 @@ void tscProcessMultiVnodesInsertForFile(SSqlObj *pSql);
void tscKillMetricQuery(SSqlObj *pSql);
void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen);
int32_t tscBuildResultsForEmptyRetrieval(SSqlObj *pSql);
bool tscIsUpdateQuery(STscObj *pObj);
// transfer SSqlInfo to SqlCmd struct
int32_t tscToSQLCmd(SSqlObj *pSql, struct SSqlInfo *pInfo);
......
......@@ -289,15 +289,17 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getResultSetImp(
return JNI_CONNECTION_NULL;
}
int num_fields = taos_field_count(tscon);
if (num_fields != 0) {
jlong ret = (jlong)taos_use_result(tscon);
jniTrace("jobj:%p, taos:%p, get resultset:%p", jobj, tscon, (void *)ret);
return ret;
jlong ret = 0;
if (tscIsUpdateQuery(tscon)) {
ret = 0; // for update query, no result pointer
jniTrace("jobj:%p, taos:%p, no result", jobj, tscon);
} else {
ret = (jlong) taos_use_result(tscon);
jniTrace("jobj:%p, taos:%p, get resultset:%p", jobj, tscon, (void *) ret);
}
jniTrace("jobj:%p, taos:%p, no resultset", jobj, tscon);
return 0;
return ret;
}
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(JNIEnv *env, jobject jobj, jlong con,
......
......@@ -255,8 +255,7 @@ static tSQLSyntaxNode *createSyntaxTree(SSchema *pSchema, int32_t numOfCols, cha
t0 = tStrGetToken(str, i, false, 0, NULL);
if (t0.n == 0 || t0.type == TK_RP) {
if (pLeft->nodeType != TSQL_NODE_EXPR) {
// if left is not the expr, it is not a legal expr
if (pLeft->nodeType != TSQL_NODE_EXPR) { // if left is not the expr, it is not a legal expr
tSQLSyntaxNodeDestroy(pLeft, NULL);
return NULL;
}
......@@ -320,13 +319,13 @@ static tSQLSyntaxNode *createSyntaxTree(SSchema *pSchema, int32_t numOfCols, cha
pn->colId = -1;
return pn;
} else {
int32_t optr = getBinaryExprOptr(&t0);
if (optr <= 0) {
uint8_t localOptr = getBinaryExprOptr(&t0);
if (localOptr <= 0) {
pError("not support binary operator:%d", t0.type);
return NULL;
}
return parseRemainStr(str, pBinExpr, pSchema, optr, numOfCols, i);
return parseRemainStr(str, pBinExpr, pSchema, localOptr, numOfCols, i);
}
}
......
......@@ -1817,3 +1817,17 @@ int16_t tscGetJoinTagColIndexByUid(SSqlCmd* pCmd, uint64_t uid) {
return pTagCond->joinInfo.right.tagCol;
}
}
bool tscIsUpdateQuery(STscObj* pObj) {
if (pObj == NULL || pObj->signature != pObj) {
globalCode = TSDB_CODE_DISCONNECTED;
return TSDB_CODE_DISCONNECTED;
}
SSqlCmd* pCmd = &(pObj->pSql->cmd);
if (pCmd->command >= TSDB_SQL_INSERT && pCmd->command <= TSDB_SQL_DROP_DNODE) {
return 1;
}
return 0;
}
......@@ -134,7 +134,7 @@ public class TSDBJNIConnector {
}
}
// Try retrieving result set for the executed SQLusing the current connection pointer. If the executed
// Try retrieving result set for the executed SQL using the current connection pointer. If the executed
// SQL is a DML/DDL which doesn't return a result set, then taosResultSetPointer should be 0L. Otherwise,
// taosResultSetPointer should be a non-zero value.
taosResultSetPointer = this.getResultSetImp(this.taos);
......
......@@ -122,9 +122,6 @@ void taos_close_stream(TAOS_STREAM *tstr);
int taos_load_table_info(TAOS *taos, const char* tableNameList);
// TODO: `configDir` should not be declared here
extern char configDir[]; // the path to global configuration
#ifdef __cplusplus
}
#endif
......
......@@ -89,7 +89,7 @@ extern "C" {
} else { \
return (x) < (y) ? -1 : 1; \
} \
} while (0);
} while (0)
#define GET_INT8_VAL(x) (*(int8_t *)(x))
#define GET_INT16_VAL(x) (*(int16_t *)(x))
......
......@@ -1140,7 +1140,7 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
SAcctObj * pAcct = NULL;
SUserObj * pUser = NULL;
SDbObj * pDb = NULL;
char dbName[TSDB_METER_ID_LEN];
char dbName[256] = {0};
pConnectMsg = (SConnectMsg *)pMsg;
......@@ -1158,7 +1158,6 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
pAcct = mgmtGetAcct(pUser->acct);
if (pConnectMsg->db[0]) {
memset(dbName, 0, sizeof(dbName));
sprintf(dbName, "%x%s%s", pAcct->acctId, TS_PATH_DELIMITER, pConnectMsg->db);
pDb = mgmtGetDb(dbName);
if (pDb == NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册