func (parser *ParserImpl) transformTargetEntry(restarget *ResTarget) (tle *TargetEntry, err error) { tle = &TargetEntry{} err = nil tle.Expr, err = parser.transformExpr(restarget.val) /* ResName, ResNo */ tle.ResName = system.Name(restarget.name) tle.ResJunk = false return }
func (s *MySuite) TestYYParse_1(c *C) { query := " select col1, col2 FROM tab1" lexer := newLexer(query) yyParse(lexer) node, ok := TopList[0].(*SelectStmt) if !ok { c.Error("node is not SelectStmt") } c.Check(node.targetList[0].name, Equals, "col1") c.Check(node.targetList[1].name, Equals, "col2") c.Check(node.fromList[0].(*RangeVar).RelationName, Equals, system.Name("tab1")) }