Sha256: 698beca411f5f28be0c7183de1fecd354fdd314a623a2bf80ce5818fc6be24d4

Contents?: true

Size: 1.22 KB

Versions: 28

Compression:

Stored size: 1.22 KB

Contents

require 'data_objects'
if RUBY_PLATFORM =~ /java/
  require 'do_jdbc'
  require 'java'

  module DataObjects
    module Sqlite3
      JDBC_DRIVER = 'org.sqlite.JDBC'
    end
  end

  begin
    java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Sqlite3::JDBC_DRIVER, true)
  rescue
    require 'jdbc/sqlite3' # the JDBC driver, packaged as a gem
  end

  # Another way of loading the JDBC Class. This seems to be more reliable
  # than Class.forName() or
  # Thread.currentThread.getContextClassLoader().loadClass() within the
  # data_objects.Connection Java class, which is currently not working as
  # expected.
  java_import DataObjects::Sqlite3::JDBC_DRIVER
end

begin
  require 'do_sqlite3/do_sqlite3'
rescue LoadError
  if RUBY_PLATFORM =~ /mingw|mswin/ then
    RUBY_VERSION =~ /(\d+.\d+)/
    require "do_sqlite3/#{$1}/do_sqlite3"
  else
    raise
  end
end

require 'do_sqlite3/version'
require 'do_sqlite3/transaction' if RUBY_PLATFORM !~ /java/

if RUBY_PLATFORM =~ /java/

  DataObjects::Sqlite3::Connection.class_eval do

    def self.pool_size
      # sqlite3 can have only one write access at a time, with this
      # concurrent write access will result in "Database locked" errors
      1
    end

  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
do_sqlite3-0.10.8 lib/do_sqlite3.rb
do_sqlite3-0.10.8-x86-mswin32-60 lib/do_sqlite3.rb
do_sqlite3-0.10.8-x86-mingw32 lib/do_sqlite3.rb
do_sqlite3-0.10.8-java lib/do_sqlite3.rb
do_sqlite3-0.10.7 lib/do_sqlite3.rb
do_sqlite3-0.10.7-x86-mswin32-60 lib/do_sqlite3.rb
do_sqlite3-0.10.7-x86-mingw32 lib/do_sqlite3.rb
do_sqlite3-0.10.7-java lib/do_sqlite3.rb
do_sqlite3-0.10.6 lib/do_sqlite3.rb
do_sqlite3-0.10.6-x86-mswin32-60 lib/do_sqlite3.rb
do_sqlite3-0.10.6-x86-mingw32 lib/do_sqlite3.rb
do_sqlite3-0.10.6-java lib/do_sqlite3.rb
do_sqlite3-0.10.5 lib/do_sqlite3.rb
do_sqlite3-0.10.5-x86-mswin32-60 lib/do_sqlite3.rb
do_sqlite3-0.10.5-x86-mingw32 lib/do_sqlite3.rb
do_sqlite3-0.10.5-java lib/do_sqlite3.rb
do_sqlite3-0.10.4 lib/do_sqlite3.rb
do_sqlite3-0.10.4-x86-mswin32-60 lib/do_sqlite3.rb
do_sqlite3-0.10.4-x86-mingw32 lib/do_sqlite3.rb
do_sqlite3-0.10.4-java lib/do_sqlite3.rb