예제 #1
0
파일: query.go 프로젝트: umitanuki/metabo
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
}
예제 #2
0
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"))
}