提交 9e280acb 编写于 作者: H hjxilinx

[td-168]

上级 a32ee46d
......@@ -423,7 +423,7 @@ int32_t tscInvalidSQLErrMsg(char *msg, const char *additionalInfo, const char *s
void tscQueueAsyncFreeResult(SSqlObj *pSql);
int32_t tscToSQLCmd(SSqlObj *pSql, struct SSqlInfo *pInfo);
char * tscGetResultColumnChr(SSqlRes *pRes, SQueryInfo *pQueryInfo, int32_t column);
char * tscGetResultColumnChr(SSqlRes *pRes, SQueryInfo *pQueryInfo, int32_t column, int16_t bytes);
extern void * pVnodeConn;
extern void * tscCacheHandle;
......
......@@ -317,7 +317,7 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
SFieldSupInfo* pSup = taosArrayGet(pQueryInfo->fieldsInfo.pSupportInfo, i);
if (pSup->pSqlExpr != NULL) {
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i);
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i, pSup->pSqlExpr->resBytes);
} else {
// todo add
}
......
......@@ -206,7 +206,6 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case TSDB_SQL_DROP_ACCT:
case TSDB_SQL_DROP_DNODE:
case TSDB_SQL_DROP_DB: {
const char* msg1 = "invalid ip address";
const char* msg2 = "invalid name";
const char* msg3 = "param name too long";
......@@ -230,10 +229,6 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
if (!validateIpAddress(pzName->z, pzName->n)) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
strncpy(pTableMetaInfo->name, pzName->z, pzName->n);
} else { // drop user
if (pzName->n > TSDB_USER_LEN) {
......@@ -364,14 +359,10 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
case TSDB_SQL_CFG_DNODE: {
const char* msg1 = "invalid ip address";
const char* msg2 = "invalid configure options or values";
/* validate the ip address */
tDCLSQL* pDCL = pInfo->pDCLInfo;
if (!validateIpAddress(pDCL->a[0].z, pDCL->a[0].n)) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
/* validate the parameter names and options */
if (validateDNodeConfig(pDCL) != TSDB_CODE_SUCCESS) {
......
......@@ -422,8 +422,9 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
if (pQueryInfo == NULL)
return 0;
assert(0);
for (int i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i);
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i, 0);
}
*rows = pRes->tsrow;
......
......@@ -1967,7 +1967,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) {
for (int i = 0; i < tscNumOfFields(pQueryInfo); ++i) {
SFieldSupInfo* pSup = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, i);
if (pSup->pSqlExpr != NULL) {
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i) + pSup->pSqlExpr->resBytes * pRes->row;
pRes->tsrow[i] = tscGetResultColumnChr(pRes, pQueryInfo, i, pSup->pSqlExpr->resBytes);
}
// primary key column cannot be null in interval query, no need to check
......
......@@ -2122,17 +2122,22 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
}
}
char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t column) {
char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t column, int16_t bytes) {
SFieldInfo* pFieldInfo = &pQueryInfo->fieldsInfo;
SFieldSupInfo* pInfo = tscFieldInfoGetSupp(pFieldInfo, column);
int32_t type = pInfo->pSqlExpr->resType;
char* pData = ((char*) pRes->data) + pInfo->pSqlExpr->offset * pRes->numOfRows;
char* pData = ((char*) pRes->data) + pInfo->pSqlExpr->offset * pRes->numOfRows + bytes * pRes->row;
if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY) {
int32_t realLen = *(int16_t*) pData;
if (realLen < pInfo->pSqlExpr->resBytes - sizeof(int16_t)) { // todo refactor
*(char*) (pData + realLen + sizeof(int16_t)) = 0;
}
if (type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_BINARY) {
return pData;
} else {
return pData + sizeof(int16_t); // head is the length of binary/nchar data
} else {
return pData;
}
}
......@@ -120,7 +120,7 @@ cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
}
cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDBTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y); }
cmd ::= DROP DNODE IPTOKEN(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
cmd ::= DROP DNODE ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &X); }
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &X); }
......@@ -136,8 +136,8 @@ cmd ::= DESCRIBE ids(X) cpxName(Y). {
/////////////////////////////////THE ALTER STATEMENT////////////////////////////////////////
cmd ::= ALTER USER ids(X) PASS ids(Y). { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PASSWD, &X, &Y, NULL); }
cmd ::= ALTER USER ids(X) PRIVILEGE ids(Y). { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PRIVILEGES, &X, NULL, &Y);}
cmd ::= ALTER DNODE IPTOKEN(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &X, &Y); }
cmd ::= ALTER DNODE IPTOKEN(X) ids(Y) ids(Z). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &X, &Y, &Z); }
cmd ::= ALTER DNODE ids(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &X, &Y); }
cmd ::= ALTER DNODE ids(X) ids(Y) ids(Z). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &X, &Y, &Z); }
cmd ::= ALTER LOCAL ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &X); }
cmd ::= ALTER LOCAL ids(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &X, &Y); }
cmd ::= ALTER DATABASE ids(X) alter_db_optr(Y). { SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &X, &Y, &t);}
......
......@@ -6315,16 +6315,27 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
char* data = NULL;
for(int32_t j = 0; j < pQuery->numOfOutput; ++j) {
// todo check the return value
// todo check the return value, refactor codes
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
tsdbGetTableName(pQInfo->tsdb, &item->id, &data);
strncpy(pQuery->sdata[j]->data + i * TSDB_TABLE_NAME_LEN, data, TSDB_TABLE_NAME_LEN);
char* dst = pQuery->sdata[j]->data + i * (TSDB_TABLE_NAME_LEN + sizeof(int16_t));
*(int16_t*) dst = strnlen(data, TSDB_TABLE_NAME_LEN);
dst += sizeof(int16_t);
strncpy(dst, data, TSDB_TABLE_NAME_LEN);
tfree(data);
} else {
} else {// todo refactor, return the true length of binary|nchar data
tsdbGetTableTagVal(pQInfo->tsdb, &item->id, pExprInfo[j].base.colInfo.colId, &type, &bytes, &data);
assert(bytes == pExprInfo[j].bytes && type == pExprInfo[j].type);
memcpy(pQuery->sdata[j]->data + i * bytes, data, bytes);
char* dst = pQuery->sdata[j]->data + i * bytes;
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
memcpy(dst, data, varDataTLen(data));
} else {
memcpy(dst, data, bytes);
}
}
}
......
......@@ -202,62 +202,61 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (531)
#define YY_ACTTAB_COUNT (529)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 752, 440, 133, 151, 244, 10, 616, 246, 133, 441,
/* 10 */ 133, 156, 821, 41, 43, 20, 35, 36, 820, 155,
/* 20 */ 821, 29, 741, 440, 201, 39, 37, 40, 38, 132,
/* 30 */ 499, 441, 97, 34, 33, 101, 152, 32, 31, 30,
/* 40 */ 41, 43, 741, 35, 36, 153, 137, 164, 29, 727,
/* 50 */ 749, 201, 39, 37, 40, 38, 186, 101, 225, 224,
/* 60 */ 34, 33, 163, 730, 32, 31, 30, 400, 401, 402,
/* 0 */ 752, 440, 135, 153, 244, 10, 616, 246, 135, 441,
/* 10 */ 135, 158, 821, 41, 43, 20, 35, 36, 820, 157,
/* 20 */ 821, 29, 741, 440, 203, 39, 37, 40, 38, 134,
/* 30 */ 499, 441, 99, 34, 33, 103, 154, 32, 31, 30,
/* 40 */ 41, 43, 741, 35, 36, 155, 139, 166, 29, 727,
/* 50 */ 749, 203, 39, 37, 40, 38, 188, 103, 227, 226,
/* 60 */ 34, 33, 165, 730, 32, 31, 30, 400, 401, 402,
/* 70 */ 403, 404, 405, 406, 407, 408, 409, 410, 411, 245,
/* 80 */ 730, 41, 43, 189, 35, 36, 216, 236, 198, 29,
/* 90 */ 58, 20, 201, 39, 37, 40, 38, 32, 31, 30,
/* 100 */ 56, 34, 33, 76, 730, 32, 31, 30, 43, 236,
/* 110 */ 35, 36, 776, 817, 196, 29, 20, 20, 201, 39,
/* 120 */ 37, 40, 38, 165, 570, 727, 227, 34, 33, 440,
/* 130 */ 168, 32, 31, 30, 238, 35, 36, 441, 7, 816,
/* 140 */ 29, 61, 111, 201, 39, 37, 40, 38, 223, 228,
/* 80 */ 730, 41, 43, 191, 35, 36, 218, 238, 200, 29,
/* 90 */ 58, 20, 203, 39, 37, 40, 38, 32, 31, 30,
/* 100 */ 56, 34, 33, 76, 730, 32, 31, 30, 43, 238,
/* 110 */ 35, 36, 776, 817, 198, 29, 20, 20, 203, 39,
/* 120 */ 37, 40, 38, 167, 570, 727, 229, 34, 33, 440,
/* 130 */ 170, 32, 31, 30, 240, 35, 36, 441, 7, 816,
/* 140 */ 29, 61, 113, 203, 39, 37, 40, 38, 225, 230,
/* 150 */ 727, 727, 34, 33, 50, 728, 32, 31, 30, 15,
/* 160 */ 215, 237, 214, 213, 212, 211, 210, 209, 208, 207,
/* 160 */ 217, 239, 216, 215, 214, 213, 212, 211, 210, 209,
/* 170 */ 712, 51, 701, 702, 703, 704, 705, 706, 707, 708,
/* 180 */ 709, 710, 711, 160, 583, 11, 815, 574, 101, 577,
/* 190 */ 101, 580, 169, 160, 583, 222, 221, 574, 16, 577,
/* 200 */ 20, 580, 34, 33, 146, 26, 32, 31, 30, 238,
/* 210 */ 87, 86, 140, 175, 657, 157, 158, 124, 145, 200,
/* 220 */ 183, 715, 180, 714, 149, 157, 158, 160, 583, 531,
/* 230 */ 60, 574, 150, 577, 726, 580, 237, 16, 39, 37,
/* 180 */ 709, 710, 711, 162, 583, 11, 815, 574, 103, 577,
/* 190 */ 103, 580, 171, 162, 583, 224, 223, 574, 16, 577,
/* 200 */ 20, 580, 34, 33, 148, 26, 32, 31, 30, 240,
/* 210 */ 88, 87, 142, 177, 657, 159, 160, 126, 147, 202,
/* 220 */ 185, 715, 182, 714, 151, 159, 160, 162, 583, 531,
/* 230 */ 60, 574, 152, 577, 726, 580, 239, 16, 39, 37,
/* 240 */ 40, 38, 27, 775, 26, 59, 34, 33, 551, 552,
/* 250 */ 32, 31, 30, 138, 114, 115, 68, 64, 67, 157,
/* 260 */ 158, 96, 515, 666, 185, 512, 124, 513, 26, 514,
/* 270 */ 523, 148, 128, 126, 240, 89, 88, 188, 42, 159,
/* 280 */ 74, 78, 239, 85, 77, 572, 528, 729, 42, 582,
/* 290 */ 80, 17, 658, 166, 167, 124, 243, 242, 93, 582,
/* 250 */ 32, 31, 30, 140, 116, 117, 68, 64, 67, 159,
/* 260 */ 160, 98, 515, 666, 187, 512, 126, 513, 26, 514,
/* 270 */ 523, 150, 130, 128, 91, 90, 89, 190, 42, 161,
/* 280 */ 74, 78, 83, 86, 77, 572, 528, 729, 42, 582,
/* 290 */ 80, 17, 658, 168, 169, 126, 243, 242, 95, 582,
/* 300 */ 47, 542, 543, 600, 581, 45, 13, 12, 584, 576,
/* 310 */ 139, 579, 12, 575, 581, 578, 2, 73, 72, 48,
/* 320 */ 505, 573, 42, 743, 45, 504, 205, 9, 8, 21,
/* 330 */ 21, 141, 519, 582, 520, 517, 142, 518, 84, 83,
/* 340 */ 143, 144, 135, 131, 136, 830, 134, 786, 581, 785,
/* 350 */ 161, 782, 781, 162, 751, 721, 768, 226, 98, 767,
/* 360 */ 112, 113, 516, 668, 206, 110, 129, 24, 219, 665,
/* 370 */ 220, 829, 26, 70, 828, 826, 187, 116, 686, 25,
/* 380 */ 91, 22, 130, 655, 79, 653, 81, 651, 650, 538,
/* 390 */ 170, 125, 190, 648, 647, 646, 644, 194, 52, 740,
/* 400 */ 636, 127, 642, 640, 638, 49, 755, 102, 756, 44,
/* 410 */ 769, 199, 197, 195, 193, 191, 28, 218, 75, 229,
/* 420 */ 230, 231, 232, 233, 234, 235, 203, 53, 241, 614,
/* 430 */ 171, 172, 147, 62, 65, 174, 613, 177, 173, 179,
/* 440 */ 612, 176, 649, 178, 181, 643, 123, 687, 117, 119,
/* 450 */ 118, 120, 121, 90, 103, 725, 108, 104, 105, 122,
/* 460 */ 106, 107, 109, 92, 1, 23, 182, 188, 605, 184,
/* 470 */ 525, 55, 539, 57, 99, 154, 192, 18, 63, 4,
/* 480 */ 544, 100, 480, 585, 3, 19, 5, 14, 202, 6,
/* 490 */ 204, 479, 478, 477, 476, 475, 474, 473, 471, 45,
/* 500 */ 217, 444, 66, 21, 501, 500, 46, 498, 54, 465,
/* 510 */ 463, 455, 461, 457, 69, 459, 71, 453, 451, 472,
/* 520 */ 470, 82, 426, 442, 94, 415, 413, 618, 617, 617,
/* 530 */ 95,
/* 310 */ 141, 579, 12, 575, 581, 578, 2, 73, 72, 48,
/* 320 */ 505, 573, 42, 743, 45, 504, 207, 9, 8, 21,
/* 330 */ 21, 143, 519, 582, 520, 517, 144, 518, 85, 84,
/* 340 */ 145, 146, 137, 133, 138, 830, 136, 786, 581, 785,
/* 350 */ 163, 782, 781, 164, 751, 721, 768, 228, 100, 767,
/* 360 */ 114, 115, 516, 668, 208, 112, 131, 24, 221, 665,
/* 370 */ 222, 829, 26, 70, 828, 826, 189, 118, 686, 25,
/* 380 */ 93, 22, 132, 655, 79, 653, 81, 82, 651, 538,
/* 390 */ 650, 172, 192, 127, 648, 647, 646, 196, 52, 740,
/* 400 */ 645, 644, 636, 129, 642, 640, 49, 638, 44, 105,
/* 410 */ 755, 756, 201, 199, 195, 769, 197, 193, 28, 220,
/* 420 */ 75, 231, 232, 233, 234, 235, 236, 205, 237, 241,
/* 430 */ 53, 614, 173, 174, 175, 149, 62, 65, 176, 613,
/* 440 */ 179, 181, 649, 178, 180, 612, 92, 94, 183, 121,
/* 450 */ 184, 120, 687, 119, 122, 725, 123, 125, 124, 109,
/* 460 */ 106, 104, 643, 107, 110, 108, 111, 23, 1, 190,
/* 470 */ 605, 186, 525, 55, 539, 57, 156, 101, 194, 18,
/* 480 */ 19, 4, 544, 102, 204, 585, 3, 14, 5, 6,
/* 490 */ 63, 480, 206, 479, 478, 477, 476, 475, 474, 473,
/* 500 */ 471, 45, 219, 444, 66, 21, 501, 500, 46, 498,
/* 510 */ 54, 465, 463, 455, 461, 457, 69, 459, 453, 451,
/* 520 */ 472, 470, 71, 442, 96, 97, 415, 413, 618,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 207, 1, 256, 206, 207, 256, 204, 205, 256, 9,
......@@ -300,20 +299,20 @@ static const YYCODETYPE yy_lookahead[] = {
/* 370 */ 207, 207, 103, 207, 207, 207, 240, 207, 207, 207,
/* 380 */ 59, 207, 207, 207, 207, 207, 207, 207, 207, 107,
/* 390 */ 207, 207, 259, 207, 207, 207, 207, 259, 117, 253,
/* 400 */ 207, 207, 207, 207, 207, 119, 208, 252, 208, 116,
/* 410 */ 208, 111, 115, 110, 109, 108, 121, 75, 84, 83,
/* 420 */ 49, 80, 82, 53, 81, 79, 208, 208, 75, 5,
/* 430 */ 132, 5, 208, 212, 212, 58, 5, 5, 132, 58,
/* 440 */ 5, 132, 208, 132, 132, 208, 215, 222, 221, 216,
/* 450 */ 220, 219, 217, 209, 251, 240, 246, 250, 249, 218,
/* 460 */ 248, 247, 245, 209, 213, 210, 58, 104, 86, 124,
/* 470 */ 97, 105, 97, 101, 96, 1, 96, 101, 72, 112,
/* 480 */ 97, 96, 9, 97, 96, 101, 112, 96, 98, 96,
/* 490 */ 98, 5, 5, 5, 5, 1, 5, 5, 5, 101,
/* 500 */ 15, 76, 72, 101, 5, 5, 16, 97, 96, 5,
/* 510 */ 5, 5, 5, 5, 127, 5, 127, 5, 5, 5,
/* 520 */ 5, 58, 58, 76, 21, 59, 58, 0, 267, 267,
/* 530 */ 21, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 400 */ 207, 207, 207, 207, 207, 207, 119, 207, 116, 251,
/* 410 */ 208, 208, 111, 115, 109, 208, 110, 108, 121, 75,
/* 420 */ 84, 83, 49, 80, 82, 53, 81, 208, 79, 75,
/* 430 */ 208, 5, 132, 5, 132, 208, 212, 212, 58, 5,
/* 440 */ 5, 58, 208, 132, 132, 5, 209, 209, 132, 216,
/* 450 */ 58, 220, 222, 221, 219, 240, 217, 215, 218, 247,
/* 460 */ 250, 252, 208, 249, 246, 248, 245, 210, 213, 104,
/* 470 */ 86, 124, 97, 105, 97, 101, 1, 96, 96, 101,
/* 480 */ 101, 112, 97, 96, 98, 97, 96, 96, 112, 96,
/* 490 */ 72, 9, 98, 5, 5, 5, 5, 1, 5, 5,
/* 500 */ 5, 101, 15, 76, 72, 101, 5, 5, 16, 97,
/* 510 */ 96, 5, 5, 5, 5, 5, 127, 5, 5, 5,
/* 520 */ 5, 5, 127, 76, 21, 21, 59, 58, 0, 267,
/* 530 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 540 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 550 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 560 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
......@@ -333,41 +332,41 @@ static const YYCODETYPE yy_lookahead[] = {
/* 700 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 710 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 720 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 730 */ 267, 267, 267, 267,
/* 730 */ 267, 267,
};
#define YY_SHIFT_COUNT (246)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (527)
#define YY_SHIFT_MAX (528)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 141, 74, 182, 226, 128, 128, 128, 128, 128, 128,
/* 10 */ 0, 22, 226, 260, 260, 260, 102, 128, 128, 128,
/* 20 */ 128, 128, 31, 149, 9, 9, 531, 192, 226, 226,
/* 20 */ 128, 128, 31, 149, 9, 9, 529, 192, 226, 226,
/* 30 */ 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
/* 40 */ 226, 226, 226, 226, 226, 260, 260, 25, 25, 25,
/* 50 */ 25, 25, 25, 42, 25, 165, 128, 128, 135, 135,
/* 60 */ 185, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 70 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 80 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 90 */ 128, 128, 128, 128, 128, 128, 269, 321, 321, 282,
/* 100 */ 282, 321, 281, 286, 293, 300, 297, 303, 305, 307,
/* 110 */ 295, 269, 321, 321, 342, 342, 321, 334, 336, 371,
/* 120 */ 341, 340, 370, 343, 346, 321, 353, 321, 353, 531,
/* 130 */ 531, 27, 68, 68, 68, 94, 119, 213, 213, 213,
/* 140 */ 216, 169, 169, 169, 169, 190, 208, 67, 89, 60,
/* 150 */ 60, 236, 173, 204, 205, 206, 211, 304, 308, 284,
/* 160 */ 220, 199, 53, 223, 228, 229, 327, 330, 191, 201,
/* 170 */ 266, 424, 298, 426, 306, 377, 431, 309, 432, 311,
/* 180 */ 381, 435, 312, 408, 382, 345, 363, 373, 366, 372,
/* 190 */ 375, 378, 474, 380, 383, 385, 376, 367, 384, 374,
/* 200 */ 386, 388, 391, 390, 393, 392, 406, 473, 486, 487,
/* 210 */ 488, 489, 494, 491, 492, 493, 398, 425, 485, 430,
/* 220 */ 490, 387, 389, 402, 499, 500, 410, 412, 402, 504,
/* 230 */ 505, 506, 507, 508, 510, 512, 513, 514, 515, 463,
/* 240 */ 464, 447, 503, 509, 466, 468, 527,
/* 90 */ 128, 128, 128, 128, 128, 128, 128, 128, 269, 321,
/* 100 */ 321, 282, 282, 321, 281, 287, 292, 301, 298, 306,
/* 110 */ 305, 309, 297, 269, 321, 321, 344, 344, 321, 336,
/* 120 */ 338, 373, 343, 342, 372, 345, 349, 321, 354, 321,
/* 130 */ 354, 529, 529, 27, 68, 68, 68, 94, 119, 213,
/* 140 */ 213, 213, 216, 169, 169, 169, 169, 190, 208, 67,
/* 150 */ 89, 60, 60, 236, 173, 204, 205, 206, 211, 304,
/* 160 */ 308, 284, 220, 199, 53, 223, 228, 229, 327, 330,
/* 170 */ 191, 201, 266, 426, 300, 428, 302, 380, 434, 311,
/* 180 */ 435, 312, 383, 440, 316, 392, 384, 347, 365, 375,
/* 190 */ 368, 374, 377, 381, 475, 382, 385, 387, 378, 369,
/* 200 */ 379, 376, 388, 390, 391, 386, 393, 394, 418, 482,
/* 210 */ 488, 489, 490, 491, 496, 493, 494, 495, 400, 427,
/* 220 */ 487, 432, 492, 389, 395, 404, 501, 502, 412, 414,
/* 230 */ 404, 506, 507, 508, 509, 510, 512, 513, 514, 515,
/* 240 */ 516, 447, 503, 504, 467, 469, 528,
};
#define YY_REDUCE_COUNT (130)
#define YY_REDUCE_COUNT (132)
#define YY_REDUCE_MIN (-254)
#define YY_REDUCE_MAX (255)
#define YY_REDUCE_MAX (257)
static const short yy_reduce_ofst[] = {
/* 0 */ -198, -53, -254, -246, -150, -172, -192, -116, -91, -90,
/* 10 */ -207, -203, -248, -179, -162, -138, -218, -175, -19, -17,
......@@ -378,11 +377,11 @@ static const short yy_reduce_ofst[] = {
/* 60 */ 121, 153, 154, 156, 157, 159, 160, 161, 162, 163,
/* 70 */ 164, 166, 167, 168, 170, 171, 172, 174, 175, 176,
/* 80 */ 177, 178, 179, 180, 181, 183, 184, 186, 187, 188,
/* 90 */ 189, 193, 194, 195, 196, 197, 136, 198, 200, 133,
/* 100 */ 138, 202, 146, 155, 203, 207, 209, 212, 214, 210,
/* 110 */ 217, 215, 218, 219, 221, 222, 224, 225, 227, 230,
/* 120 */ 233, 232, 235, 241, 231, 234, 244, 237, 254, 251,
/* 130 */ 255,
/* 90 */ 189, 193, 194, 195, 196, 197, 198, 200, 136, 202,
/* 100 */ 203, 133, 138, 207, 146, 209, 158, 210, 214, 217,
/* 110 */ 212, 218, 221, 215, 219, 222, 224, 225, 227, 230,
/* 120 */ 232, 231, 233, 235, 239, 240, 242, 234, 237, 254,
/* 130 */ 238, 255, 257,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 615, 667, 823, 823, 615, 615, 615, 615, 615, 615,
......@@ -394,21 +393,21 @@ static const YYACTIONTYPE yy_default[] = {
/* 60 */ 746, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 70 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 654,
/* 80 */ 615, 652, 615, 615, 615, 615, 615, 615, 615, 615,
/* 90 */ 615, 615, 615, 641, 615, 615, 615, 635, 635, 615,
/* 100 */ 615, 635, 779, 783, 777, 765, 773, 764, 760, 759,
/* 110 */ 787, 615, 635, 635, 664, 664, 635, 685, 683, 681,
/* 120 */ 673, 679, 675, 677, 671, 635, 662, 635, 662, 700,
/* 130 */ 713, 615, 788, 822, 778, 806, 805, 818, 812, 811,
/* 140 */ 615, 810, 809, 808, 807, 615, 615, 615, 615, 814,
/* 150 */ 813, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 160 */ 790, 784, 780, 615, 615, 615, 615, 615, 615, 615,
/* 90 */ 615, 615, 615, 615, 615, 641, 615, 615, 615, 635,
/* 100 */ 635, 615, 615, 635, 779, 783, 777, 765, 773, 764,
/* 110 */ 760, 759, 787, 615, 635, 635, 664, 664, 635, 685,
/* 120 */ 683, 681, 673, 679, 675, 677, 671, 635, 662, 635,
/* 130 */ 662, 700, 713, 615, 788, 822, 778, 806, 805, 818,
/* 140 */ 812, 811, 615, 810, 809, 808, 807, 615, 615, 615,
/* 150 */ 615, 814, 813, 615, 615, 615, 615, 615, 615, 615,
/* 160 */ 615, 615, 790, 784, 780, 615, 615, 615, 615, 615,
/* 170 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 180 */ 615, 615, 615, 615, 615, 615, 745, 615, 615, 754,
/* 190 */ 615, 615, 615, 615, 615, 615, 774, 615, 766, 615,
/* 200 */ 615, 615, 615, 615, 615, 722, 615, 615, 615, 615,
/* 210 */ 615, 615, 615, 615, 615, 615, 688, 615, 615, 615,
/* 220 */ 615, 615, 615, 827, 615, 615, 615, 716, 825, 615,
/* 230 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 180 */ 615, 615, 615, 615, 615, 615, 615, 615, 745, 615,
/* 190 */ 615, 754, 615, 615, 615, 615, 615, 615, 774, 615,
/* 200 */ 766, 615, 615, 615, 615, 615, 615, 722, 615, 615,
/* 210 */ 615, 615, 615, 615, 615, 615, 615, 615, 688, 615,
/* 220 */ 615, 615, 615, 615, 615, 827, 615, 615, 615, 716,
/* 230 */ 825, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 240 */ 615, 615, 639, 637, 615, 631, 615,
};
/********** End of lemon-generated parsing tables *****************************/
......@@ -1019,15 +1018,15 @@ static const char *const yyRuleName[] = {
/* 24 */ "cmd ::= SHOW dbPrefix VGROUPS ids",
/* 25 */ "cmd ::= DROP TABLE ifexists ids cpxName",
/* 26 */ "cmd ::= DROP DATABASE ifexists ids",
/* 27 */ "cmd ::= DROP DNODE IPTOKEN",
/* 27 */ "cmd ::= DROP DNODE ids",
/* 28 */ "cmd ::= DROP USER ids",
/* 29 */ "cmd ::= DROP ACCOUNT ids",
/* 30 */ "cmd ::= USE ids",
/* 31 */ "cmd ::= DESCRIBE ids cpxName",
/* 32 */ "cmd ::= ALTER USER ids PASS ids",
/* 33 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
/* 34 */ "cmd ::= ALTER DNODE IPTOKEN ids",
/* 35 */ "cmd ::= ALTER DNODE IPTOKEN ids ids",
/* 34 */ "cmd ::= ALTER DNODE ids ids",
/* 35 */ "cmd ::= ALTER DNODE ids ids ids",
/* 36 */ "cmd ::= ALTER LOCAL ids",
/* 37 */ "cmd ::= ALTER LOCAL ids ids",
/* 38 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
......@@ -1692,15 +1691,15 @@ static const struct {
{ 205, -4 }, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */
{ 205, -5 }, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */
{ 205, -4 }, /* (26) cmd ::= DROP DATABASE ifexists ids */
{ 205, -3 }, /* (27) cmd ::= DROP DNODE IPTOKEN */
{ 205, -3 }, /* (27) cmd ::= DROP DNODE ids */
{ 205, -3 }, /* (28) cmd ::= DROP USER ids */
{ 205, -3 }, /* (29) cmd ::= DROP ACCOUNT ids */
{ 205, -2 }, /* (30) cmd ::= USE ids */
{ 205, -3 }, /* (31) cmd ::= DESCRIBE ids cpxName */
{ 205, -5 }, /* (32) cmd ::= ALTER USER ids PASS ids */
{ 205, -5 }, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */
{ 205, -4 }, /* (34) cmd ::= ALTER DNODE IPTOKEN ids */
{ 205, -5 }, /* (35) cmd ::= ALTER DNODE IPTOKEN ids ids */
{ 205, -4 }, /* (34) cmd ::= ALTER DNODE ids ids */
{ 205, -5 }, /* (35) cmd ::= ALTER DNODE ids ids ids */
{ 205, -3 }, /* (36) cmd ::= ALTER LOCAL ids */
{ 205, -4 }, /* (37) cmd ::= ALTER LOCAL ids ids */
{ 205, -4 }, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */
......@@ -2063,7 +2062,7 @@ static void yy_reduce(
case 26: /* cmd ::= DROP DATABASE ifexists ids */
{ setDropDBTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); }
break;
case 27: /* cmd ::= DROP DNODE IPTOKEN */
case 27: /* cmd ::= DROP DNODE ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER ids */
......@@ -2087,10 +2086,10 @@ static void yy_reduce(
case 33: /* cmd ::= ALTER USER ids PRIVILEGE ids */
{ setAlterUserSQL(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);}
break;
case 34: /* cmd ::= ALTER DNODE IPTOKEN ids */
case 34: /* cmd ::= ALTER DNODE ids ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 35: /* cmd ::= ALTER DNODE IPTOKEN ids ids */
case 35: /* cmd ::= ALTER DNODE ids ids ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 36: /* cmd ::= ALTER LOCAL ids */
......
......@@ -232,10 +232,18 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable);
STColumn* pCol = NULL;
int32_t offset = 0;
for(int32_t col = 0; col < schemaNCols(pSchema); ++col) {
STColumn* p = schemaColAt(pSchema, col);
if (p->colId == colId) {
pCol = p;
break;
}
if (p->type == TSDB_DATA_TYPE_BINARY || p->type == TSDB_DATA_TYPE_NCHAR) {
offset += sizeof(int16_t);
} else {
offset += p->bytes;
}
}
......@@ -246,7 +254,7 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
assert(pCol != NULL);
SDataRow row = (SDataRow)pTable->tagVal;
char* d = dataRowTuple(row);
char* d = tdGetRowDataOfCol(row, pCol->type, TD_DATA_ROW_HEAD_SIZE + offset);
*val = d;
*type = pCol->type;
......
......@@ -1052,10 +1052,18 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, TSKEY maxKey, int max
pData = pColInfo->pData + (maxRowsToRead - numOfRows - 1) * pColInfo->info.bytes;
}
if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) {
void *value = tdGetRowDataOfCol(row, pColInfo->info.type, TD_DATA_ROW_HEAD_SIZE + offset);
memcpy(pData, value, varDataTLen(value));
offset += sizeof(int16_t);
} else {
memcpy(pData, dataRowTuple(row) + offset, pColInfo->info.bytes);
offset += pColInfo->info.bytes;
}
}
numOfRows++;
if (numOfRows >= maxRowsToRead) {
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册