From 638865fd5ba005e11e04e226cd8c3513a81e0970 Mon Sep 17 00:00:00 2001 From: fang Date: Tue, 24 Sep 2019 15:21:06 +0800 Subject: [PATCH] [JIRANONE] modify JDBC client, if there is no action after query, before return 0 rows result, now throw exception --- src/client/src/TSDBJNIConnector.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index 5ffa1c34fc..9853a6dec1 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -396,8 +396,18 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn TAOS_ROW row = taos_fetch_row(result); if (row == NULL) { - jniTrace("jobj:%p, taos:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, res, num_fields); - return JNI_FETCH_END; + int tserrno = taos_errno(tscon); + if (tserrno == 0) { + jniTrace("jobj:%p, taos:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, res, num_fields); + return JNI_FETCH_END; + } else { + jclass cls; + cls = (*env)->FindClass(env,"com/taosdata/jdbc/TSDBError"); + if(cls == NULL){ + return JNI_TDENGINE_ERROR; + } + (*env)->ThrowNew(env,cls,"Interruppted query"); + } } for (int i = 0; i < num_fields; i++) { @@ -619,4 +629,4 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset(JNIEnv *env, jobject jobj) { return (*env)->NewStringUTF(env, (const char *)tsCharset); -} \ No newline at end of file +}