commit
88c447b3f9
|
@ -752,6 +752,10 @@ static bool validateTableColumnInfo(tFieldList* pFieldList, SSqlCmd* pCmd) {
|
||||||
|
|
||||||
int32_t nLen = 0;
|
int32_t nLen = 0;
|
||||||
for (int32_t i = 0; i < pFieldList->nField; ++i) {
|
for (int32_t i = 0; i < pFieldList->nField; ++i) {
|
||||||
|
if (pFieldList->p[i].bytes == 0) {
|
||||||
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
nLen += pFieldList->p[i].bytes;
|
nLen += pFieldList->p[i].bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +812,10 @@ static bool validateTagParams(tFieldList* pTagsList, tFieldList* pFieldList, SSq
|
||||||
|
|
||||||
int32_t nLen = 0;
|
int32_t nLen = 0;
|
||||||
for (int32_t i = 0; i < pTagsList->nField; ++i) {
|
for (int32_t i = 0; i < pTagsList->nField; ++i) {
|
||||||
|
if (pTagsList->p[i].bytes == 0) {
|
||||||
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg7);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
nLen += pTagsList->p[i].bytes;
|
nLen += pTagsList->p[i].bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,12 +251,20 @@ alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLeve
|
||||||
alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
|
alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
|
||||||
|
|
||||||
%type typename {TAOS_FIELD}
|
%type typename {TAOS_FIELD}
|
||||||
typename(A) ::= ids(X). { tSQLSetColumnType (&A, &X); }
|
typename(A) ::= ids(X). {
|
||||||
|
X.type = 0;
|
||||||
|
tSQLSetColumnType (&A, &X);
|
||||||
|
}
|
||||||
|
|
||||||
//define binary type, e.g., binary(10), nchar(10)
|
//define binary type, e.g., binary(10), nchar(10)
|
||||||
typename(A) ::= ids(X) LP signed(Y) RP. {
|
typename(A) ::= ids(X) LP signed(Y) RP. {
|
||||||
X.type = -Y; // negative value of name length
|
if (Y <= 0) {
|
||||||
tSQLSetColumnType(&A, &X);
|
X.type = 0;
|
||||||
|
tSQLSetColumnType(&A, &X);
|
||||||
|
} else {
|
||||||
|
X.type = -Y; // negative value of name length
|
||||||
|
tSQLSetColumnType(&A, &X);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%type signed {int64_t}
|
%type signed {int64_t}
|
||||||
|
|
|
@ -497,10 +497,18 @@ void tSQLSetColumnType(TAOS_FIELD *pField, SSQLToken *type) {
|
||||||
* number of bytes in UCS-4 format, which is 4 times larger than the
|
* number of bytes in UCS-4 format, which is 4 times larger than the
|
||||||
* number of characters
|
* number of characters
|
||||||
*/
|
*/
|
||||||
pField->bytes = -(int32_t)type->type * TSDB_NCHAR_SIZE + LENGTH_SIZE_OF_STR;
|
if (type->type == 0) {
|
||||||
|
pField->bytes = 0;
|
||||||
|
} else {
|
||||||
|
pField->bytes = -(int32_t)type->type * TSDB_NCHAR_SIZE + LENGTH_SIZE_OF_STR;
|
||||||
|
}
|
||||||
} else if (i == TSDB_DATA_TYPE_BINARY) {
|
} else if (i == TSDB_DATA_TYPE_BINARY) {
|
||||||
/* for binary, the TOKENTYPE is the length of binary */
|
/* for binary, the TOKENTYPE is the length of binary */
|
||||||
pField->bytes = -(int32_t) type->type + LENGTH_SIZE_OF_STR;
|
if (type->type == 0) {
|
||||||
|
pField->bytes = 0;
|
||||||
|
} else {
|
||||||
|
pField->bytes = -(int32_t) type->type + LENGTH_SIZE_OF_STR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,17 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/************ Begin %include sections from the grammar ************************/
|
/************ Begin %include sections from the grammar ************************/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "tutil.h"
|
||||||
#include "qsqlparser.h"
|
#include "qsqlparser.h"
|
||||||
#include "tstoken.h"
|
#include "tstoken.h"
|
||||||
#include "tutil.h"
|
|
||||||
#include "tvariant.h"
|
#include "tvariant.h"
|
||||||
#include "ttokendef.h"
|
#include "ttokendef.h"
|
||||||
#include "qsqltype.h"
|
#include "qsqltype.h"
|
||||||
|
|
||||||
/**************** End of %include directives **********************************/
|
/**************** End of %include directives **********************************/
|
||||||
/* These constants specify the various numeric values for terminal symbols
|
/* These constants specify the various numeric values for terminal symbols
|
||||||
** in a format understandable to "makeheaders". This section is blank unless
|
** in a format understandable to "makeheaders". This section is blank unless
|
||||||
|
@ -2262,13 +2262,21 @@ static void yy_reduce(
|
||||||
{ setDefaultCreateDbOption(&yymsp[1].minor.yy374);}
|
{ setDefaultCreateDbOption(&yymsp[1].minor.yy374);}
|
||||||
break;
|
break;
|
||||||
case 102: /* typename ::= ids */
|
case 102: /* typename ::= ids */
|
||||||
{ tSQLSetColumnType (&yylhsminor.yy325, &yymsp[0].minor.yy0); }
|
{
|
||||||
|
yymsp[0].minor.yy0.type = 0;
|
||||||
|
tSQLSetColumnType (&yylhsminor.yy325, &yymsp[0].minor.yy0);
|
||||||
|
}
|
||||||
yymsp[0].minor.yy325 = yylhsminor.yy325;
|
yymsp[0].minor.yy325 = yylhsminor.yy325;
|
||||||
break;
|
break;
|
||||||
case 103: /* typename ::= ids LP signed RP */
|
case 103: /* typename ::= ids LP signed RP */
|
||||||
{
|
{
|
||||||
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy279; // negative value of name length
|
if (yymsp[-1].minor.yy279 <= 0) {
|
||||||
tSQLSetColumnType(&yylhsminor.yy325, &yymsp[-3].minor.yy0);
|
yymsp[-3].minor.yy0.type = 0;
|
||||||
|
tSQLSetColumnType(&yylhsminor.yy325, &yymsp[-3].minor.yy0);
|
||||||
|
} else {
|
||||||
|
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy279; // negative value of name length
|
||||||
|
tSQLSetColumnType(&yylhsminor.yy325, &yymsp[-3].minor.yy0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
yymsp[-3].minor.yy325 = yylhsminor.yy325;
|
yymsp[-3].minor.yy325 = yylhsminor.yy325;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue