From 21806f647e55136fa1bde1b3003450ff29ffb26b Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 19 Jul 2019 19:02:59 +0800 Subject: [PATCH] Fix the issure #118, Change the alter tag value sql syntax --- src/inc/sql.y | 2 +- src/util/src/sql.c | 166 ++++++++++++++++++++++----------------------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/inc/sql.y b/src/inc/sql.y index 2a0e9f6..bf3c184 100755 --- a/src/inc/sql.y +++ b/src/inc/sql.y @@ -560,7 +560,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_CHG); } -cmd ::= ALTER TABLE ids(X) cpxName(F) SET ids(Y) EQ tagitem(Z). { +cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { X.n += F.n; toTSDBType(Y.type); diff --git a/src/util/src/sql.c b/src/util/src/sql.c index 807d5c0..b402c85 100644 --- a/src/util/src/sql.c +++ b/src/util/src/sql.c @@ -120,16 +120,16 @@ typedef union { #define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 -#define YYNSTATE 217 +#define YYNSTATE 218 #define YYNRULE 180 -#define YY_MAX_SHIFT 216 -#define YY_MIN_SHIFTREDUCE 347 -#define YY_MAX_SHIFTREDUCE 526 -#define YY_MIN_REDUCE 527 -#define YY_MAX_REDUCE 706 -#define YY_ERROR_ACTION 707 -#define YY_ACCEPT_ACTION 708 -#define YY_NO_ACTION 709 +#define YY_MAX_SHIFT 217 +#define YY_MIN_SHIFTREDUCE 348 +#define YY_MAX_SHIFTREDUCE 527 +#define YY_MIN_REDUCE 528 +#define YY_MAX_REDUCE 707 +#define YY_ERROR_ACTION 708 +#define YY_ACCEPT_ACTION 709 +#define YY_NO_ACTION 710 /************* End control #defines *******************************************/ /* The yyzerominor constant is used to initialize instances of @@ -203,54 +203,54 @@ static const YYMINORTYPE yyzerominor = { 0 }; *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (474) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 379, 31, 30, 708, 216, 29, 28, 27, 380, 68, - /* 10 */ 69, 75, 38, 40, 379, 32, 33, 211, 437, 70, - /* 20 */ 26, 54, 380, 183, 36, 34, 37, 35, 133, 215, - /* 30 */ 435, 7, 31, 30, 58, 99, 29, 28, 27, 38, - /* 40 */ 40, 431, 32, 33, 428, 10, 429, 26, 430, 115, - /* 50 */ 183, 36, 34, 37, 35, 442, 89, 139, 509, 31, + /* 0 */ 380, 31, 30, 709, 217, 29, 28, 27, 381, 68, + /* 10 */ 69, 75, 38, 40, 380, 32, 33, 212, 438, 70, + /* 20 */ 26, 54, 381, 183, 36, 34, 37, 35, 133, 216, + /* 30 */ 436, 7, 31, 30, 58, 99, 29, 28, 27, 38, + /* 40 */ 40, 432, 32, 33, 429, 10, 430, 26, 431, 115, + /* 50 */ 183, 36, 34, 37, 35, 443, 89, 139, 510, 31, /* 60 */ 30, 113, 115, 29, 28, 27, 38, 40, 149, 32, - /* 70 */ 33, 508, 134, 151, 26, 115, 45, 183, 36, 34, - /* 80 */ 37, 35, 89, 138, 509, 112, 31, 30, 379, 53, - /* 90 */ 29, 28, 27, 46, 439, 40, 380, 32, 33, 464, + /* 70 */ 33, 509, 134, 151, 26, 115, 45, 183, 36, 34, + /* 80 */ 37, 35, 89, 138, 510, 112, 31, 30, 380, 53, + /* 90 */ 29, 28, 27, 46, 440, 40, 381, 32, 33, 465, /* 100 */ 89, 178, 26, 114, 136, 183, 36, 34, 37, 35, - /* 110 */ 102, 103, 61, 477, 31, 30, 427, 146, 29, 28, - /* 120 */ 27, 20, 20, 180, 150, 55, 89, 204, 63, 427, - /* 130 */ 119, 432, 348, 349, 350, 351, 352, 353, 354, 355, - /* 140 */ 356, 357, 358, 463, 147, 148, 424, 424, 209, 32, + /* 110 */ 102, 103, 61, 478, 31, 30, 428, 146, 29, 28, + /* 120 */ 27, 20, 20, 180, 150, 55, 89, 205, 204, 428, + /* 130 */ 119, 433, 349, 350, 351, 352, 353, 354, 355, 356, + /* 140 */ 357, 358, 359, 464, 147, 148, 425, 425, 210, 32, /* 150 */ 33, 29, 28, 27, 26, 199, 157, 183, 36, 34, - /* 160 */ 37, 35, 483, 165, 486, 162, 31, 30, 425, 56, + /* 160 */ 37, 35, 484, 165, 487, 162, 31, 30, 426, 56, /* 170 */ 29, 28, 27, 17, 198, 197, 196, 195, 194, 193, - /* 180 */ 192, 191, 190, 189, 411, 505, 400, 401, 402, 403, - /* 190 */ 404, 405, 406, 407, 408, 409, 410, 143, 490, 113, - /* 200 */ 200, 481, 11, 484, 48, 487, 20, 143, 490, 415, - /* 210 */ 135, 481, 427, 484, 57, 487, 458, 459, 132, 49, - /* 220 */ 504, 20, 77, 76, 126, 23, 426, 20, 503, 140, - /* 230 */ 141, 423, 131, 182, 109, 107, 78, 207, 206, 140, - /* 240 */ 141, 143, 490, 440, 205, 481, 424, 484, 129, 487, - /* 250 */ 210, 22, 424, 513, 214, 213, 367, 24, 514, 449, - /* 260 */ 479, 450, 24, 42, 507, 15, 491, 142, 14, 171, + /* 180 */ 192, 191, 190, 189, 412, 506, 401, 402, 403, 404, + /* 190 */ 405, 406, 407, 408, 409, 410, 411, 143, 491, 113, + /* 200 */ 200, 482, 11, 485, 48, 488, 20, 143, 491, 416, + /* 210 */ 135, 482, 428, 485, 57, 488, 459, 460, 132, 49, + /* 220 */ 505, 20, 77, 76, 126, 23, 427, 20, 504, 140, + /* 230 */ 141, 424, 131, 182, 109, 107, 78, 208, 207, 140, + /* 240 */ 141, 143, 491, 441, 206, 482, 425, 485, 129, 488, + /* 250 */ 211, 22, 425, 514, 215, 214, 368, 24, 515, 450, + /* 260 */ 480, 451, 24, 42, 508, 15, 492, 142, 14, 171, /* 270 */ 14, 130, 167, 140, 141, 36, 34, 37, 35, 128, - /* 280 */ 120, 421, 39, 31, 30, 42, 420, 29, 28, 27, - /* 290 */ 21, 489, 39, 482, 187, 485, 480, 2, 21, 67, - /* 300 */ 66, 489, 9, 8, 121, 433, 488, 434, 74, 73, - /* 310 */ 122, 123, 124, 125, 117, 523, 488, 111, 118, 116, - /* 320 */ 412, 474, 441, 473, 86, 98, 39, 144, 470, 469, - /* 330 */ 145, 456, 418, 208, 455, 489, 100, 101, 386, 188, - /* 340 */ 110, 203, 522, 64, 521, 519, 104, 168, 80, 105, - /* 350 */ 488, 377, 376, 71, 374, 373, 445, 152, 106, 371, - /* 360 */ 370, 170, 50, 47, 436, 369, 362, 172, 108, 176, - /* 370 */ 366, 364, 41, 181, 84, 444, 179, 457, 177, 175, - /* 380 */ 173, 25, 22, 202, 185, 90, 44, 212, 526, 153, - /* 390 */ 154, 51, 155, 156, 127, 59, 62, 525, 378, 372, - /* 400 */ 158, 79, 81, 368, 159, 422, 160, 161, 1, 96, - /* 410 */ 93, 91, 92, 94, 524, 95, 97, 163, 164, 517, - /* 420 */ 166, 12, 13, 169, 85, 446, 87, 137, 174, 4, - /* 430 */ 18, 451, 88, 5, 492, 3, 19, 16, 184, 6, - /* 440 */ 186, 60, 398, 397, 396, 395, 394, 393, 392, 391, - /* 450 */ 390, 42, 389, 388, 383, 21, 417, 201, 416, 65, - /* 460 */ 414, 52, 381, 72, 360, 43, 527, 529, 529, 529, - /* 470 */ 529, 82, 529, 83, + /* 280 */ 120, 422, 39, 31, 30, 42, 421, 29, 28, 27, + /* 290 */ 21, 490, 39, 483, 187, 486, 481, 2, 21, 67, + /* 300 */ 66, 490, 9, 8, 121, 434, 489, 435, 74, 73, + /* 310 */ 122, 123, 124, 125, 117, 524, 489, 111, 118, 116, + /* 320 */ 413, 475, 442, 474, 86, 98, 39, 144, 471, 470, + /* 330 */ 145, 457, 419, 209, 456, 490, 100, 101, 387, 188, + /* 340 */ 110, 203, 523, 64, 522, 520, 104, 168, 80, 105, + /* 350 */ 489, 378, 377, 71, 375, 374, 446, 152, 106, 372, + /* 360 */ 371, 170, 50, 47, 437, 370, 363, 172, 108, 176, + /* 370 */ 367, 365, 41, 181, 84, 445, 179, 458, 177, 175, + /* 380 */ 173, 25, 22, 202, 185, 90, 44, 213, 527, 153, + /* 390 */ 154, 51, 155, 156, 127, 59, 62, 526, 379, 373, + /* 400 */ 158, 79, 81, 369, 159, 423, 160, 161, 1, 96, + /* 410 */ 93, 91, 92, 94, 525, 95, 97, 163, 164, 518, + /* 420 */ 166, 12, 13, 169, 85, 447, 87, 137, 174, 4, + /* 430 */ 18, 452, 88, 5, 493, 3, 19, 16, 184, 6, + /* 440 */ 186, 60, 399, 398, 397, 396, 395, 394, 393, 392, + /* 450 */ 391, 42, 390, 389, 384, 21, 418, 201, 417, 63, + /* 460 */ 415, 52, 382, 72, 361, 43, 528, 530, 530, 530, + /* 470 */ 530, 82, 65, 83, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 1, 33, 34, 187, 188, 37, 38, 39, 9, 61, @@ -300,10 +300,10 @@ static const YYCODETYPE yy_lookahead[] = { /* 440 */ 88, 67, 9, 5, 5, 5, 5, 1, 5, 5, /* 450 */ 5, 91, 5, 5, 73, 91, 5, 15, 5, 118, /* 460 */ 87, 86, 73, 70, 56, 16, 0, 240, 240, 240, - /* 470 */ 240, 21, 240, 21, + /* 470 */ 240, 21, 118, 21, }; #define YY_SHIFT_USE_DFLT (-74) -#define YY_SHIFT_COUNT (216) +#define YY_SHIFT_COUNT (217) #define YY_SHIFT_MIN (-73) #define YY_SHIFT_MAX (466) static const short yy_shift_ofst[] = { @@ -327,8 +327,8 @@ static const short yy_shift_ofst[] = { /* 170 */ 310, 312, 338, 340, 426, 342, 344, 346, 339, 329, /* 180 */ 345, 333, 347, 349, 351, 350, 353, 352, 374, 433, /* 190 */ 438, 439, 440, 441, 446, 443, 444, 445, 447, 448, - /* 200 */ 360, 381, 442, 449, 341, 364, 451, 453, 373, 375, - /* 210 */ 364, 393, 389, 450, 452, 408, 466, + /* 200 */ 360, 381, 442, 449, 341, 354, 364, 451, 453, 373, + /* 210 */ 375, 364, 393, 389, 450, 452, 408, 466, }; #define YY_REDUCE_USE_DFLT (-185) #define YY_REDUCE_COUNT (110) @@ -349,28 +349,28 @@ static const short yy_reduce_ofst[] = { /* 110 */ 213, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 707, 565, 691, 691, 707, 707, 707, 707, 707, 707, - /* 10 */ 623, 539, 707, 707, 691, 707, 707, 707, 707, 707, - /* 20 */ 707, 707, 618, 707, 707, 707, 707, 707, 707, 707, - /* 30 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 40 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 50 */ 707, 707, 707, 707, 707, 640, 640, 707, 707, 707, - /* 60 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 70 */ 707, 555, 707, 707, 707, 707, 707, 707, 707, 707, - /* 80 */ 707, 707, 707, 707, 707, 541, 541, 707, 707, 541, - /* 90 */ 647, 651, 645, 633, 641, 632, 628, 627, 655, 707, - /* 100 */ 541, 541, 564, 564, 541, 707, 541, 562, 541, 562, - /* 110 */ 579, 707, 695, 696, 656, 690, 646, 674, 673, 686, - /* 120 */ 680, 679, 678, 677, 676, 675, 707, 707, 707, 682, - /* 130 */ 681, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 140 */ 707, 707, 707, 658, 652, 648, 707, 707, 707, 707, - /* 150 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 160 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 170 */ 692, 707, 707, 707, 707, 707, 707, 707, 642, 707, - /* 180 */ 634, 707, 707, 707, 707, 707, 707, 599, 707, 707, - /* 190 */ 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - /* 200 */ 567, 707, 707, 707, 707, 700, 707, 707, 707, 593, - /* 210 */ 698, 707, 707, 545, 543, 707, 707, + /* 0 */ 708, 566, 692, 692, 708, 708, 708, 708, 708, 708, + /* 10 */ 624, 540, 708, 708, 692, 708, 708, 708, 708, 708, + /* 20 */ 708, 708, 619, 708, 708, 708, 708, 708, 708, 708, + /* 30 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 40 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 50 */ 708, 708, 708, 708, 708, 641, 641, 708, 708, 708, + /* 60 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 70 */ 708, 556, 708, 708, 708, 708, 708, 708, 708, 708, + /* 80 */ 708, 708, 708, 708, 708, 542, 542, 708, 708, 542, + /* 90 */ 648, 652, 646, 634, 642, 633, 629, 628, 656, 708, + /* 100 */ 542, 542, 565, 565, 542, 708, 542, 563, 542, 563, + /* 110 */ 580, 708, 696, 697, 657, 691, 647, 675, 674, 687, + /* 120 */ 681, 680, 679, 678, 677, 676, 708, 708, 708, 683, + /* 130 */ 682, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 140 */ 708, 708, 708, 659, 653, 649, 708, 708, 708, 708, + /* 150 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 160 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 170 */ 693, 708, 708, 708, 708, 708, 708, 708, 643, 708, + /* 180 */ 635, 708, 708, 708, 708, 708, 708, 600, 708, 708, + /* 190 */ 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + /* 200 */ 568, 708, 708, 708, 708, 708, 701, 708, 708, 708, + /* 210 */ 594, 699, 708, 708, 546, 544, 708, 708, }; /********** End of lemon-generated parsing tables *****************************/ @@ -901,7 +901,7 @@ static const char *const yyRuleName[] = { /* 173 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", /* 174 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", /* 175 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 176 */ "cmd ::= ALTER TABLE ids cpxName SET ids EQ tagitem", + /* 176 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", /* 177 */ "cmd ::= KILL CONNECTION IP COLON INTEGER", /* 178 */ "cmd ::= KILL STREAM IP COLON INTEGER COLON INTEGER", /* 179 */ "cmd ::= KILL QUERY IP COLON INTEGER COLON INTEGER", @@ -1446,7 +1446,7 @@ static const struct { { 188, 7 }, { 188, 7 }, { 188, 8 }, - { 188, 8 }, + { 188, 9 }, { 188, 5 }, { 188, 7 }, { 188, 7 }, @@ -2064,15 +2064,15 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_CHG); } break; - case 176: /* cmd ::= ALTER TABLE ids cpxName SET ids EQ tagitem */ + case 176: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { - yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; + yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); A = tVariantListAppend(A, &yymsp[0].minor.yy266, -1); - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-5].minor.yy0, NULL, A, ALTER_TABLE_TAGS_SET); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, ALTER_TABLE_TAGS_SET); setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_SET); } break; -- GitLab