Sha256: b954ea556b027fefc3b57b0b64c4857141567ca5ec057f16b03ca420d45983e5

Contents?: true

Size: 930 Bytes

Versions: 23

Compression:

Stored size: 930 Bytes

Contents

require 'rubygems'

$LOAD_PATH.unshift("xampl_generated_code")

require 'TokyoCabinetExperimental'

Xampl.set_default_persister_kind(:tokyo_cabinet)
Xampl.set_default_persister_format(:xml_format)

module TokyoCabinetExperimental

  start = Time.now
  found = Xampl.transaction("setup") do
    Xampl.query do | q |
      q.add_condition('age', :numle, '50')
      q.order_by('age', :numasc)
    end
  end
  query_done = Time.now

  total = 0
  found.each do | person_meta |
    total += person_meta['age'].to_i
  end

  meta_done = Time.now

  total1 = 0
  found.each do | person_meta |
    total1 += person_meta['xampl'].age.to_i
  end

  done = Time.now

  found.each do | person_meta |
    puts "name: #{ person_meta['name']}"
  end
  puts "found: #{ found.size }"
  puts "Total age: #{ total }, #{ total1 }"
  puts "done: #{ done - start }:: #{ query_done - start } + #{ meta_done - query_done } + #{ done - meta_done }"

end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
hutch-xamplr-1.3.9 examples/tokyo-cabinet-experimental/expt-query.rb
xamplr-1.3.15 examples/tokyo-cabinet-experimental/expt-query.rb
xamplr-1.2.0 examples/tokyo-cabinet-experimental/expt-query.rb