Skip to content

Commit

Permalink
very basic select
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaben committed Apr 2, 2010
1 parent f21a48b commit d0fff8b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion XMLConnection.go
Expand Up @@ -145,6 +145,7 @@ func (e *XMLConnector) init() {
}
}

func (e *XMLConnector) Commit() { e.commit() }
func (e *XMLConnector) commit() {
e.db.Seek(0, 0)
e.db.Truncate(0)
Expand Down Expand Up @@ -243,8 +244,24 @@ func (e *XMLTable) Insert(val map[string]Value) {
e.data.Push(val)
}

func min(a,b int) int {if (a > b ) { return b}; return a }

func (e *XMLConnector) Query(r *Relation) *vector.Vector {
return new(vector.Vector)
ret := new(vector.Vector)


fmt.Println(r)
switch r.kind {
case SELECT:
dat := e.tables[r.table].data
limit:=0
if(r.limit_count > 0 ){ limit=r.limit_offset+r.limit_count }
limit=min(limit,dat.Len())
for i:=r.limit_offset; i < limit ; i++ {
ret.Push(dat.At(i))
}
}
return ret
}

func OpenXML(conStr string) Connection {
Expand Down

0 comments on commit d0fff8b

Please sign in to comment.