Add support for UNION statements

This commit is contained in:
zer0sub 2019-05-01 14:42:46 +02:00
parent fef8f0ef83
commit 8a3521a016
8 changed files with 140 additions and 219 deletions

View file

@ -21,8 +21,6 @@ type SelectStatement interface {
FOR_UPDATE() SelectStatement
Copy() SelectStatement
AsTable(alias string) *SelectStatementTable
}
@ -159,7 +157,7 @@ func (q *selectStatementImpl) Sql() (query string, args []interface{}, err error
return "", nil, err
}
return queryData.queryBuff.String(), queryData.args, nil
return queryData.buff.String(), queryData.args, nil
}
func (s *selectStatementImpl) AsTable(alias string) *SelectStatementTable {
@ -169,19 +167,6 @@ func (s *selectStatementImpl) AsTable(alias string) *SelectStatementTable {
}
}
func (s *selectStatementImpl) Query(db types.Db, destination interface{}) error {
return Query(s, db, destination)
}
func (u *selectStatementImpl) Execute(db types.Db) (res sql.Result, err error) {
return Execute(u, db)
}
func (s *selectStatementImpl) Copy() SelectStatement {
ret := *s
return &ret
}
func (q *selectStatementImpl) WHERE(expression BoolExpression) SelectStatement {
q.where = expression
return q
@ -224,6 +209,14 @@ func (q *selectStatementImpl) FOR_UPDATE() SelectStatement {
return q
}
func (s *selectStatementImpl) Query(db types.Db, destination interface{}) error {
return Query(s, db, destination)
}
func (u *selectStatementImpl) Execute(db types.Db) (res sql.Result, err error) {
return Execute(u, db)
}
func NumExp(statement SelectStatement) NumericExpression {
return newNumericExpressionWrap(statement)
}