Hi, all, I am trying to get the text string in the parser for product 'value_experssion', but I cannot find a good way to do it for a long time without success. Does anyone know how to do that?
Example, here is a production for function firstdayofyear: | TOK_FIRSTDAYOFYEAR '(' value_expression ')' { $$ = new (PARSERHEAP()) ZZZBinderFunction(ITM_FIRSTDAYOFYEAR, $3); } if the user input string for this production is "firstdayofyear ( tbl1.col1 )" I want to get the full string as "firstdayofyear (tbl1.col1)" So here is the code I tried but failed: | TOK_FIRSTDAYOFYEAR '(' value_expression ')' { NAString *utf8Str3 = unicodeToChar (ToTokvalPlusYYText(&$3)->yytext, ToTokvalPlusYYText(&$3)->yyleng, (CharInfo::CharSet) ( ComGetNameInterfaceCharSet() // CharInfo::UTF8 ), PARSERHEAP()); NAString fullstr = "firstdayofyear ( " + *utf8Str3 + ")"; $$ = new (PARSERHEAP()) ZZZBinderFunction(ITM_FIRSTDAYOFYEAR, $3); } utf8Str3 is a NULL pointer for "firstdayofyear (tbl1.col1) ", because a column will be parsed as an ItemExpr pointer, and ToTokvalPlusYYText failed to convert it and get correct yytext. I cannot find an example in the sqlparser.y for this, so ask help in the mail list. The alternative way I now use is checking if utf8Str3 is NULL, if yes, then this is not what I need, since luckily in my case, the value_expression must be a function name which can always get the correct yytext. But I hope there is a better way to do this. thanks, Ming