Sha256: f595f5cda37a11388d446b49a38795ef3ab0689313875856d4f170188f7d544c

Contents?: true

Size: 1.91 KB

Versions: 17

Compression:

Stored size: 1.91 KB

Contents

$LOAD_PATH.unshift("xampl_generated_code")

require 'RandomPeople'
require 'people'
require 'settings'

module RandomPeople

  #GivenName,Surname,StreetAddress,City,State,ZipCode,EmailAddress,TelephoneNumber
  #<people pid='' xmlns="http://xampl.com/people">
  #    <person pid=''
  #            given-name=''
  #            surname=''
  #            street-address=''
  #            city=''
  #            state=''
  #            postal-code=''
  #            email=''
  #            phone=''/>
  #</people>

  5.times do
    found1 = []
    found2 = []
    found3 = []

    start_query_at = Time.now
    found1 = Xampl.transaction("random-people") do
      Xampl.query do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end

    start_find_at = Time.now
    found2 = Xampl.transaction("random-people") do
      Xampl.find_xampl do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end
    start_find_pids_at = Time.now

    found3 = Xampl.transaction("random-people") do
      Xampl.find_pids do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

#        q.setlimit(10, 10)

        q.order_by('surname', :strasc)
      end
    end
    done = Time.now

    #  found1.each do | person_meta |
    #    puts "surname: #{ person_meta['surname']}, given: #{ person_meta['xampl'].given_name }"
    #  end

    puts
    puts "query    :: found: #{ found1.size }, in: #{ start_find_at - start_query_at }"
    puts "find     :: found: #{ found2.size }, in: #{ start_find_pids_at - start_find_at }"
    puts "find pids:: found: #{ found3.size }, in: #{ done - start_find_pids_at}"
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hutch-xamplr-1.1.0 examples/random-people/query.rb
hutch-xamplr-1.1.1 examples/random-people/query.rb
hutch-xamplr-1.1.2 examples/random-people/query.rb
hutch-xamplr-1.1.4 examples/random-people/query.rb
hutch-xamplr-1.2.0 examples/random-people/query.rb
hutch-xamplr-1.3.0 examples/random-people/query.rb
hutch-xamplr-1.3.1 examples/random-people/query.rb
hutch-xamplr-1.3.10 examples/random-people/query.rb
hutch-xamplr-1.3.11 examples/random-people/query.rb
hutch-xamplr-1.3.12 examples/random-people/query.rb
hutch-xamplr-1.3.13 examples/random-people/query.rb
hutch-xamplr-1.3.14 examples/random-people/query.rb
hutch-xamplr-1.3.3 examples/random-people/query.rb
hutch-xamplr-1.3.8 examples/random-people/query.rb
hutch-xamplr-1.3.9 examples/random-people/query.rb
xamplr-1.3.15 examples/random-people/query.rb
xamplr-1.2.0 examples/random-people/query.rb