commit
0b40d39df2
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "tcrc32c.h"
|
#include "tcrc32c.h"
|
||||||
//todo : use the original source code
|
//todo : use the original source code
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
//#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
|
|
||||||
#define POLY 0x82f63b78
|
#define POLY 0x82f63b78
|
||||||
#define LONG_SHIFT 8192
|
#define LONG_SHIFT 8192
|
||||||
|
@ -1093,6 +1093,7 @@ static uint32_t short_shifts[4][256] = {
|
||||||
0xe1a734e7, 0xc41cc13c, 0x140cd014, 0x31b725cf, 0x5f7b3ba2, 0x7ac0ce79,
|
0xe1a734e7, 0xc41cc13c, 0x140cd014, 0x31b725cf, 0x5f7b3ba2, 0x7ac0ce79,
|
||||||
0x82e30778, 0xa758f2a3, 0xc994ecce, 0xec2f1915}};
|
0x82e30778, 0xa758f2a3, 0xc994ecce, 0xec2f1915}};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static uint32_t append_trivial(uint32_t crc, crc_stream input, size_t length) {
|
static uint32_t append_trivial(uint32_t crc, crc_stream input, size_t length) {
|
||||||
for (size_t i = 0; i < length; ++i) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
crc = crc ^ input[i];
|
crc = crc ^ input[i];
|
||||||
|
@ -1130,6 +1131,7 @@ static uint32_t append_adler_table(uint32_t crci, crc_stream input,
|
||||||
}
|
}
|
||||||
return (uint32_t)(crc ^ 0xffffffff);
|
return (uint32_t)(crc ^ 0xffffffff);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Table-driven software version as a fall-back. This is about 15 times slower
|
/* Table-driven software version as a fall-back. This is about 15 times slower
|
||||||
than using the hardware instructions. This assumes little-endian integers,
|
than using the hardware instructions. This assumes little-endian integers,
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "taos.h"
|
#include "taos.h"
|
||||||
#include "taosmsg.h"
|
#include "taosmsg.h"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
//#pragma GCC diagnostic ignored "-Wformat"
|
||||||
|
|
||||||
#define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \
|
#define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \
|
||||||
(data + (schema)->colOffset[colId] * (allrow) + (rowId) * (schema)->pFields[colId].bytes)
|
(data + (schema)->colOffset[colId] * (allrow) + (rowId) * (schema)->pFields[colId].bytes)
|
||||||
|
@ -1017,7 +1017,7 @@ static void UNUSED_FUNC tSortDataPrint(int32_t type, char *prefix, char *startx,
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
printf("%s:(%lld, %lld, %lld)\n", prefix, *(int64_t *)startx, *(int64_t *)midx, *(int64_t *)endx);
|
printf("%s:(%" PRId64 ", %" PRId64 ", %" PRId64 ")\n", prefix, *(int64_t *)startx, *(int64_t *)midx, *(int64_t *)endx);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
printf("%s:(%f, %f, %f)\n", prefix, *(float *)startx, *(float *)midx, *(float *)endx);
|
printf("%s:(%f, %f, %f)\n", prefix, *(float *)startx, *(float *)midx, *(float *)endx);
|
||||||
|
@ -1093,7 +1093,7 @@ static UNUSED_FUNC void tRowModelDisplay(tOrderDescriptor *pDescriptor, int32_t
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
printf("%lld\t", *(int64_t *)startx);
|
printf("%" PRId64 "\t", *(int64_t *)startx);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
printf("%s\t", startx);
|
printf("%s\t", startx);
|
||||||
|
@ -1264,7 +1264,7 @@ static tFilePage *loadIntoBucketFromDisk(tMemBucket *pMemBucket, int32_t segIdx,
|
||||||
assert(pPage->numOfElems > 0);
|
assert(pPage->numOfElems > 0);
|
||||||
|
|
||||||
tColModelAppend(pDesc->pSchema, buffer, pPage->data, 0, pPage->numOfElems, pPage->numOfElems);
|
tColModelAppend(pDesc->pSchema, buffer, pPage->data, 0, pPage->numOfElems, pPage->numOfElems);
|
||||||
printf("id: %d count: %d\n", j, buffer->numOfElems);
|
printf("id: %d count: %" PRIu64 "\n", j, buffer->numOfElems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tfree(pPage);
|
tfree(pPage);
|
||||||
|
@ -1376,10 +1376,16 @@ static void printBinaryData(char *data, int32_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 50) { // probably the avg intermediate result
|
if (len == 50) { // probably the avg intermediate result
|
||||||
printf("%lf,%d\t", *(double *)data, *(int64_t *)(data + sizeof(double)));
|
printf("%lf,%" PRId64 "\t", *(double *)data, *(int64_t *)(data + sizeof(double)));
|
||||||
} else if (data[8] == ',') { // in TSDB_FUNC_FIRST_DST/TSDB_FUNC_LAST_DST,
|
} else if (data[8] == ',') { // in TSDB_FUNC_FIRST_DST/TSDB_FUNC_LAST_DST,
|
||||||
// the value is seperated by ','
|
// the value is seperated by ','
|
||||||
printf("%ld,%0x\t", *(int64_t *)data, data + sizeof(int64_t) + 1);
|
//printf("%" PRId64 ",%0x\t", *(int64_t *)data, data + sizeof(int64_t) + 1);
|
||||||
|
printf("%" PRId64 ", HEX: ", *(int64_t *)data);
|
||||||
|
int32_t tmp_len = len - sizeof(int64_t) - 1;
|
||||||
|
for (int32_t i = 0; i < tmp_len; ++i) {
|
||||||
|
printf("%0x ", *(data + sizeof(int64_t) + 1 + i));
|
||||||
|
}
|
||||||
|
printf("\t");
|
||||||
} else if (isCharString) {
|
} else if (isCharString) {
|
||||||
printf("%s\t", data);
|
printf("%s\t", data);
|
||||||
}
|
}
|
||||||
|
@ -1389,26 +1395,26 @@ static void printBinaryData(char *data, int32_t len) {
|
||||||
static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
|
static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
|
||||||
if (param->functionId == TSDB_FUNC_LAST_DST) {
|
if (param->functionId == TSDB_FUNC_LAST_DST) {
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
case TSDB_DATA_TYPE_TINYINT:printf("%lld,%d\t", *(int64_t *) data, *(int8_t *) (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_TINYINT:printf("%" PRId64 ",%d\t", *(int64_t *) data, *(int8_t *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_SMALLINT:printf("%lld,%d\t", *(int64_t *) data, *(int16_t *) (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_SMALLINT:printf("%" PRId64 ",%d\t", *(int64_t *) data, *(int16_t *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
case TSDB_DATA_TYPE_BIGINT:printf("%lld,%lld\t", *(int64_t *) data, *(int64_t *) (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_BIGINT:printf("%" PRId64 ",%" PRId64 "\t", *(int64_t *) data, *(int64_t *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:printf("%lld,%d\t", *(int64_t *) data, *(float *) (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_FLOAT:printf("%" PRId64 ",%f\t", *(int64_t *) data, *(float *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:printf("%lld,%d\t", *(int64_t *) data, *(double *) (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_DOUBLE:printf("%" PRId64 ",%f\t", *(int64_t *) data, *(double *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BINARY:printf("%lld,%s\t", *(int64_t *) data, (data + TSDB_KEYSIZE + 1));
|
case TSDB_DATA_TYPE_BINARY:printf("%" PRId64 ",%s\t", *(int64_t *) data, (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
default:printf("%lld,%d\t", *(int64_t *) data, *(int32_t *) (data + TSDB_KEYSIZE + 1));
|
default:printf("%" PRId64 ",%d\t", *(int64_t *) data, *(int32_t *) (data + TSDB_KEYSIZE + 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (param->functionId == TSDB_FUNC_AVG) {
|
} else if (param->functionId == TSDB_FUNC_AVG) {
|
||||||
printf("%f,%lld\t", *(double *) data, *(int64_t *) (data + sizeof(double) + 1));
|
printf("%f,%" PRId64 "\t", *(double *) data, *(int64_t *) (data + sizeof(double) + 1));
|
||||||
} else {
|
} else {
|
||||||
// functionId == TSDB_FUNC_MAX_DST | TSDB_FUNC_TAG
|
// functionId == TSDB_FUNC_MAX_DST | TSDB_FUNC_TAG
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
@ -1420,13 +1426,13 @@ static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
printf("%lld\t", *(int64_t *)data);
|
printf("%" PRId64 "\t", *(int64_t *)data);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
printf("%d\t", *(float *)data);
|
printf("%f\t", *(float *)data);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
printf("%d\t", *(double *)data);
|
printf("%f\t", *(double *)data);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
printf("%s\t", data);
|
printf("%s\t", data);
|
||||||
|
@ -1434,7 +1440,7 @@ static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
default:
|
default:
|
||||||
printf("%d\t", *(double *)data);
|
printf("%f\t", *(double *)data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1456,7 @@ void tColModelDisplay(tColModel *pModel, void *pData, int32_t numOfRows, int32_t
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
printf("%lld\t", *(int64_t *)val);
|
printf("%" PRId64 "\t", *(int64_t *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
printf("%d\t", *(int32_t *)val);
|
printf("%d\t", *(int32_t *)val);
|
||||||
|
@ -1468,7 +1474,7 @@ void tColModelDisplay(tColModel *pModel, void *pData, int32_t numOfRows, int32_t
|
||||||
printf("%lf\t", *(double *)val);
|
printf("%lf\t", *(double *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
printf("%lld\t", *(int64_t *)val);
|
printf("%" PRId64 "\t", *(int64_t *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
printf("%d\t", *(int8_t *)val);
|
printf("%d\t", *(int8_t *)val);
|
||||||
|
@ -1501,7 +1507,7 @@ void tColModelDisplayEx(tColModel *pModel, void *pData, int32_t numOfRows, int32
|
||||||
|
|
||||||
switch (pModel->pFields[j].type) {
|
switch (pModel->pFields[j].type) {
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
printf("%lld\t", *(int64_t *)val);
|
printf("%" PRId64 "\t", *(int64_t *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
printf("%d\t", *(int32_t *)val);
|
printf("%d\t", *(int32_t *)val);
|
||||||
|
@ -1519,7 +1525,7 @@ void tColModelDisplayEx(tColModel *pModel, void *pData, int32_t numOfRows, int32
|
||||||
printf("%lf\t", *(double *)val);
|
printf("%lf\t", *(double *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
printf("%lld\t", *(int64_t *)val);
|
printf("%" PRId64 "\t", *(int64_t *)val);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
printf("%d\t", *(int8_t *)val);
|
printf("%d\t", *(int8_t *)val);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
#include "taosmsg.h"
|
#include "taosmsg.h"
|
||||||
|
@ -447,7 +447,7 @@ void tHistogramPrint(SHistogramInfo* pHisto) {
|
||||||
printf("total entries: %d, elements: %d\n", pHisto->numOfEntries, pHisto->numOfElems);
|
printf("total entries: %d, elements: %d\n", pHisto->numOfEntries, pHisto->numOfElems);
|
||||||
#if defined(USE_ARRAYLIST)
|
#if defined(USE_ARRAYLIST)
|
||||||
for (int32_t i = 0; i < pHisto->numOfEntries; ++i) {
|
for (int32_t i = 0; i < pHisto->numOfEntries; ++i) {
|
||||||
printf("%d: (%f, %lld)\n", i + 1, pHisto->elems[i].val, pHisto->elems[i].num);
|
printf("%d: (%f, %" PRId64 ")\n", i + 1, pHisto->elems[i].val, pHisto->elems[i].num);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
tSkipListNode* pNode = pHisto->pList->pHead.pForward[0];
|
tSkipListNode* pNode = pHisto->pList->pHead.pForward[0];
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -570,7 +570,7 @@ int32_t tSkipListIterateList(tSkipList *pSkipList, tSkipListNode ***pRes, bool (
|
||||||
char* tmp = realloc((*pRes), num * POINTER_BYTES);
|
char* tmp = realloc((*pRes), num * POINTER_BYTES);
|
||||||
assert(tmp != NULL);
|
assert(tmp != NULL);
|
||||||
|
|
||||||
*pRes = tmp;
|
*pRes = (tSkipListNode**)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
|
@ -688,7 +688,7 @@ void tSkipListPrint(tSkipList *pSkipList, int16_t nlevel) {
|
||||||
case TSDB_DATA_TYPE_SMALLINT:
|
case TSDB_DATA_TYPE_SMALLINT:
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
fprintf(stdout, "%d: %lld \n", id++, p->key.i64Key);
|
fprintf(stdout, "%d: %" PRId64 " \n", id++, p->key.i64Key);
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
fprintf(stdout, "%d: %s \n", id++, p->key.pz);
|
fprintf(stdout, "%d: %s \n", id++, p->key.pz);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "tstrbuild.h"
|
#include "tstrbuild.h"
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ void taosStringBuilderAppendNull(SStringBuilder* sb) { taosStringBuilderAppendSt
|
||||||
|
|
||||||
void taosStringBuilderAppendInteger(SStringBuilder* sb, int64_t v) {
|
void taosStringBuilderAppendInteger(SStringBuilder* sb, int64_t v) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
size_t len = sprintf(buf, "%lld", v);
|
size_t len = sprintf(buf, "%" PRId64, v);
|
||||||
taosStringBuilderAppendStringLen(sb, buf, len);
|
taosStringBuilderAppendStringLen(sb, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "taos.h"
|
#include "taos.h"
|
||||||
#include "tsdb.h"
|
#include "tsdb.h"
|
||||||
|
@ -213,7 +213,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
|
||||||
return sprintf(dst, "%d", (int32_t)pVar->i64Key);
|
return sprintf(dst, "%d", (int32_t)pVar->i64Key);
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
return sprintf(dst, "%lld", pVar->i64Key);
|
return sprintf(dst, "%" PRId64, pVar->i64Key);
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
|
@ -224,6 +224,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type, bool releaseVariantPtr) {
|
static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type, bool releaseVariantPtr) {
|
||||||
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
|
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
|
||||||
setNull(pDest, type, tDataTypeDesc[type].nSize);
|
setNull(pDest, type, tDataTypeDesc[type].nSize);
|
||||||
|
@ -337,7 +338,7 @@ static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static FORCE_INLINE int32_t convertToBoolImpl(char *pStr, int32_t len) {
|
static FORCE_INLINE int32_t convertToBoolImpl(char *pStr, int32_t len) {
|
||||||
if ((strncasecmp(pStr, "true", len) == 0) && (len == 4)) {
|
if ((strncasecmp(pStr, "true", len) == 0) && (len == 4)) {
|
||||||
return TSDB_TRUE;
|
return TSDB_TRUE;
|
||||||
|
@ -386,7 +387,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) {
|
if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) {
|
||||||
sprintf(pBuf == NULL ? *pDest : pBuf, "%lld", pVariant->i64Key);
|
sprintf(pBuf == NULL ? *pDest : pBuf, "%" PRId64, pVariant->i64Key);
|
||||||
} else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) {
|
} else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) {
|
||||||
sprintf(pBuf == NULL ? *pDest : pBuf, "%lf", pVariant->dKey);
|
sprintf(pBuf == NULL ? *pDest : pBuf, "%lf", pVariant->dKey);
|
||||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL) {
|
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL) {
|
||||||
|
@ -411,7 +412,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
|
||||||
int32_t nLen = 0;
|
int32_t nLen = 0;
|
||||||
|
|
||||||
if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) {
|
if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) {
|
||||||
nLen = sprintf(pDst, "%lld", pVariant->i64Key);
|
nLen = sprintf(pDst, "%" PRId64, pVariant->i64Key);
|
||||||
} else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) {
|
} else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) {
|
||||||
nLen = sprintf(pDst, "%lf", pVariant->dKey);
|
nLen = sprintf(pDst, "%lf", pVariant->dKey);
|
||||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) {
|
} else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) {
|
||||||
|
@ -437,7 +438,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
|
||||||
char* tmp = realloc(pVariant->wpz, (*pDestSize + 1)*TSDB_NCHAR_SIZE);
|
char* tmp = realloc(pVariant->wpz, (*pDestSize + 1)*TSDB_NCHAR_SIZE);
|
||||||
assert(tmp != NULL);
|
assert(tmp != NULL);
|
||||||
|
|
||||||
pVariant->wpz = tmp;
|
pVariant->wpz = (wchar_t *)tmp;
|
||||||
} else {
|
} else {
|
||||||
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE);
|
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue