提交 ca6a7ba3 编写于 作者: L lihui

[TBASE-816]

上级 3e1f3df3
......@@ -466,11 +466,17 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
case TSDB_DATA_TYPE_BIGINT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat) * ((float *)row[i]));
case TSDB_DATA_TYPE_FLOAT: {
float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat)fv);
}
break;
case TSDB_DATA_TYPE_DOUBLE:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble) * ((double *)row[i]));
case TSDB_DATA_TYPE_DOUBLE: {
double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv);
}
break;
case TSDB_DATA_TYPE_BINARY: {
strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist
......@@ -615,11 +621,17 @@ JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNI
case TSDB_DATA_TYPE_BIGINT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat) * ((float *)row[i]));
case TSDB_DATA_TYPE_FLOAT: {
float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat)fv);
}
break;
case TSDB_DATA_TYPE_DOUBLE:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble) * ((double *)row[i]));
case TSDB_DATA_TYPE_DOUBLE:{
double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv);
}
break;
case TSDB_DATA_TYPE_BINARY: {
strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist
......
......@@ -39,25 +39,17 @@ static int32_t getToStringLength(const char *pData, int32_t length, int32_t type
case TSDB_DATA_TYPE_NCHAR:
return length;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
*(int64_t *)(&dv) = *(int64_t *)pData;
len = sprintf(buf, "%f", dv);
#else
len = sprintf(buf, "%lf", *(double *)pData);
#endif
dv = GET_DOUBLE_VAL(pData);
len = sprintf(buf, "%lf", dv);
if (strncasecmp("nan", buf, 3) == 0) {
len = 4;
}
} break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
*(int32_t *)(&fv) = *(int32_t *)pData;
fv = GET_FLOAT_VAL(pData);
len = sprintf(buf, "%f", fv);
#else
len = sprintf(buf, "%f", *(float *)pData);
#endif
if (strncasecmp("nan", buf, 3) == 0) {
len = 4;
}
......@@ -201,22 +193,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
taosUcs4ToMbs(pTagValue, pSchema[i].bytes, target);
break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
*(int32_t *)(&fv) = *(int32_t *)pTagValue;
fv = GET_FLOAT_VAL(pTagValue);
sprintf(target, "%f", fv);
#else
sprintf(target, "%f", *(float *)pTagValue);
#endif
} break;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
*(int64_t *)(&dv) = *(int64_t *)pTagValue;
dv = GET_DOUBLE_VAL(pTagValue);
sprintf(target, "%lf", dv);
#else
sprintf(target, "%lf", *(double *)pTagValue);
#endif
} break;
case TSDB_DATA_TYPE_TINYINT:
sprintf(target, "%d", *(int8_t *)pTagValue);
......
......@@ -121,11 +121,11 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
break;
case TSDB_DATA_TYPE_FLOAT:
var->dKey = *(float*)tb->buffer;
var->dKey = GET_FLOAT_VAL(tb->buffer);
break;
case TSDB_DATA_TYPE_DOUBLE:
var->dKey = *(double*)tb->buffer;
var->dKey = GET_DOUBLE_VAL(tb->buffer);
break;
case TSDB_DATA_TYPE_BINARY:
......
......@@ -2165,7 +2165,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, int32_t colIdx, tSQLExprItem* pItem
if (optr == TK_PERCENTILE || optr == TK_APERCENTILE) {
tVariantDump(pVariant, val, TSDB_DATA_TYPE_DOUBLE);
double dp = *((double*)val);
double dp = GET_DOUBLE_VAL(val);
if (dp < 0 || dp > TOP_BOTTOM_QUERY_LIMIT) {
return invalidSqlErrMsg(pCmd, msg5);
}
......
......@@ -887,12 +887,18 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
len += sprintf(str + len, "%" PRId64 " ", *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT:
len += sprintf(str + len, "%f ", *((float *)row[i]));
case TSDB_DATA_TYPE_FLOAT: {
float fv = 0;
fv = GET_FLOAT_VAL(row[i])
len += sprintf(str + len, "%f ", fv);
}
break;
case TSDB_DATA_TYPE_DOUBLE:
len += sprintf(str + len, "%lf ", *((double *)row[i]));
case TSDB_DATA_TYPE_DOUBLE:{
double dv = 0;
dv = GET_DOUBLE_VAL(row[i])
len += sprintf(str + len, "%lf ", dv);
}
break;
case TSDB_DATA_TYPE_BINARY:
......
......@@ -457,25 +457,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
printf("%*" PRId64 "|", l[i], *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
//memcpy(&fv, row[i], sizeof(float));
*(int32_t*)(&fv) = *(int32_t*)row[i];
fv = GET_FLOAT_VAL(row[i]);
printf("%*.5f|", l[i], fv);
#else
printf("%*.5f|", l[i], *((float *)row[i]));
#endif
}
}
break;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
//memcpy(&dv, row[i], sizeof(double));
*(int64_t*)(&dv) = *(int64_t*)row[i];
dv = GET_DOUBLE_VAL(row[i]);
printf("%*.9f|", l[i], dv);
#else
printf("%*.9f|", l[i], *((double *)row[i]));
#endif
}
break;
case TSDB_DATA_TYPE_BINARY:
......@@ -542,25 +532,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
printf("%" PRId64 "\n", *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
//memcpy(&fv, row[i], sizeof(float));
*(int32_t*)(&fv) = *(int32_t*)row[i];
fv = GET_FLOAT_VAL(row[i]);
printf("%.5f\n", fv);
#else
printf("%.5f\n", *((float *)row[i]));
#endif
}
}
break;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
//memcpy(&dv, row[i], sizeof(double));
*(int64_t*)(&dv) = *(int64_t*)row[i];
dv = GET_DOUBLE_VAL(row[i]);
printf("%.9f\n", dv);
#else
printf("%.9f\n", *((double *)row[i]));
#endif
}
break;
case TSDB_DATA_TYPE_BINARY:
......@@ -630,25 +610,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
fprintf(fp, "%" PRId64, *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
//memcpy(&fv, row[i], sizeof(float));
*(int32_t*)(&fv) = *(int32_t*)row[i];
fv = GET_FLOAT_VAL(row[i]);
fprintf(fp, "%.5f", fv);
#else
fprintf(fp, "%.5f", *((float *)row[i]));
#endif
}
}
break;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
//memcpy(&dv, row[i], sizeof(double));
*(int64_t*)(&dv) = *(int64_t*)row[i];
dv = GET_DOUBLE_VAL(row[i]);
fprintf(fp, "%.9f", dv);
#else
fprintf(fp, "%.9f", *((double *)row[i]));
#endif
}
break;
case TSDB_DATA_TYPE_BINARY:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册