Sha256: 897408f20d60e2b9b097c5a4e3f5541a5411de70c90ea4f540bc4c5474d1bdc7

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

$TESTING=true

require 'rubygems'
require 'spec'
require 'date'
require 'pathname'

# put data_objects from repository in the load path
# DO NOT USE installed gem of data_objects!
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'data_objects', 'lib'))
require 'data_objects'

# put the pre-compiled extension in the path to be found
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'do_sqlite3'

log_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'log', 'do.log'))
FileUtils.mkdir_p(File.dirname(log_path))

DataObjects::Sqlite3.logger = DataObjects::Logger.new(log_path, 0)

at_exit { DataObjects.logger.flush }

module Sqlite3SpecHelpers

  def insert(query, *args)
    result = @connection.create_command(query).execute_non_query(*args)
    result.insert_id
  end

  def exec(query, *args)
    @connection.create_command(query).execute_non_query(*args)
  end

  def select(query, types = nil, *args)
    begin
      command = @connection.create_command(query)
      command.set_types types unless types.nil?
      reader = command.execute_reader(*args)
      reader.next!
      yield reader
    ensure
      reader.close if reader
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
do_sqlite3-0.9.2 spec/spec_helper.rb
do_sqlite3-0.9.3 spec/spec_helper.rb
do_sqlite3-0.9.4 spec/spec_helper.rb
do_sqlite3-0.9.5 spec/spec_helper.rb
do_sqlite3-0.9.6-x86-mswin32-60 spec/spec_helper.rb
do_sqlite3-0.9.6 spec/spec_helper.rb
do_sqlite3-0.9.7 spec/spec_helper.rb
do_sqlite3-0.9.8 spec/spec_helper.rb
do_sqlite3-0.9.9-x86-mswin32-60 spec/spec_helper.rb
do_sqlite3-0.9.9 spec/spec_helper.rb