提交 dbba27cd 编写于 作者: G Ganlin Zhao

fixed JNI connector

上级 bbbadfcf
......@@ -100,8 +100,6 @@ jmethodID g_blockdataSetNumOfColsFp;
#define JNI_FETCH_END -6
#define JNI_OUT_OF_MEMORY -7
#define JNI_ERR_MSG_BUF_LEN 50
static void jniGetGlobalMethod(JNIEnv *env) {
// make sure init function executed once
switch (atomic_val_compare_exchange_32(&__init, 0, 1)) {
......@@ -1055,10 +1053,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI
}
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(JNIEnv *env, jobject jobj,
jobjectArray lines, jlong conn) {
int a_lines = 0;
char errMsg[JNI_ERR_MSG_BUF_LEN] = {0};
jobjectArray lines, jlong conn,
jint protocol, jint precision) {
TAOS *taos = (TAOS *)conn;
if (taos == NULL) {
jniError("jobj:%p, connection already closed", jobj);
......@@ -1076,7 +1072,8 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
c_lines[i] = (char *)(*env)->GetStringUTFChars(env, line, 0);
}
int code = taos_schemaless_insert(taos, c_lines, numLines, SML_LINE_PROTOCOL, "ms", &a_lines, errMsg, JNI_ERR_MSG_BUF_LEN);
SSqlObj* result = (SSqlObj*)taos_schemaless_insert(taos, c_lines, numLines, protocol, precision);
int code = taos_errno(result);
for (int i = 0; i < numLines; ++i) {
jstring line = (jstring)((*env)->GetObjectArrayElement(env, lines, i));
......@@ -1085,9 +1082,10 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
tfree(c_lines);
if (code != TSDB_CODE_SUCCESS) {
jniError("jobj:%p, conn:%p, code:%s, affected lines:%d", jobj, taos, errMsg, a_lines);
jniError("jobj:%p, conn:%p, code:%s, msg:%s", jobj, taos, tstrerror(code), taos_errstr(result));
return JNI_TDENGINE_ERROR;
}
return code;
return (jlong)result;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册