BaseXdb/basex — Issue #238: [basex-api] Problem with retrieval of large amounts of data using ruby-bindings (basex-api v6.7.1 with basexserver v.6.7.11)
Author: BrackXs
Created: 2011-10-18 12:13:31+00:00
State: open

Sorry for posting this report here.
Issue tracking is disabled at the basex-api page.

I used the code below for data retrieval. as you can see, the code is very close to your examples.
What happens is this:
The basex-server is working at full processor capacity for a few seconds. Afterwards ruby is waiting indefinitely (that is, at least for a few hours) for the answer set.
This behaviour is reproducible.

data used: klopotek-export-data (data known to ch. grün)

Query used:
```
{for $y in (distinct-values(for $x in //product order by $x/title return $x/@title_id))
let $c := count(//product[@title_id=$y])
return

{element title {distinct-values(//product[@title_id=$y]/title)}}
{for $z in distinct-values(//product[@title_id = $y]/@edition_id)
return
{for $a in distinct-values(//product[@title_id=$y][@edition_id = $z]/@impression_id)
return

}
}
}
```

ruby-code used:
``` ruby
def self.test_base_x
s = BaseX::Session.new('localhost',1984,'admin','admin')
s.execute 'open xml_db_2'
t = Time.now
q = s.query(query)#see above
rv = []
begin
puts q.init
while q.more
end
rv << q.next
end
ensure
q.close
end
t = Time.now-t
File.open('../xml_db/index.xml','w') do |file|
for line in rv do
file.write(line)
end
end
puts rv.length
puts
puts t
end
```