MariaDB tests fix.

This commit is contained in:
go-jet 2019-08-15 13:54:05 +02:00
parent ec462dce81
commit e0a1eff493
14 changed files with 108 additions and 68 deletions

View file

@ -10,9 +10,9 @@ var (
)
type SelectStatement interface {
jet.Statement
Statement
jet.HasProjections
jet.Expression
Expression
DISTINCT() SelectStatement
FROM(table ReadableTable) SelectStatement
@ -32,11 +32,21 @@ type SelectStatement interface {
}
//SELECT creates new SelectStatement with list of projections
func SELECT(projection jet.Projection, projections ...jet.Projection) SelectStatement {
return newSelectStatement(nil, append([]jet.Projection{projection}, projections...))
func SELECT(projection Projection, projections ...Projection) SelectStatement {
return newSelectStatement(nil, append([]Projection{projection}, projections...))
}
func newSelectStatement(table ReadableTable, projections []jet.Projection) SelectStatement {
func toJetProjectionList(projections []Projection) []jet.Projection {
ret := []jet.Projection{}
for _, projection := range projections {
ret = append(ret, projection)
}
return ret
}
func newSelectStatement(table ReadableTable, projections []Projection) SelectStatement {
newSelect := &selectStatementImpl{}
newSelect.ExpressionStatementImpl.StatementImpl = jet.NewStatementImpl(Dialect, jet.SelectStatementType, newSelect, &newSelect.Select,
&newSelect.From, &newSelect.Where, &newSelect.GroupBy, &newSelect.Having, &newSelect.OrderBy,
@ -44,7 +54,7 @@ func newSelectStatement(table ReadableTable, projections []jet.Projection) Selec
newSelect.ExpressionStatementImpl.ExpressionInterfaceImpl.Parent = newSelect
newSelect.Select.Projections = projections
newSelect.Select.Projections = toJetProjectionList(projections)
newSelect.From.Table = table
newSelect.Limit.Count = -1
newSelect.Offset.Count = -1