Permalink
Browse files

cleaned requires

  • Loading branch information...
1 parent 3a8ddda commit b5f621569612d9675d536d7a5dc0a15d0dce4364 @qoobaa committed Nov 19, 2009
View
@@ -1,8 +1,16 @@
+# start (required by translator)
+require "time"
+require "date"
+# end
+
+require "ffi"
+
require "sqlite3/constants"
require "sqlite3/errors"
require "sqlite3/pragmas"
require "sqlite3/statement"
require "sqlite3/translator"
+require "sqlite3/resultset"
require "sqlite3/value"
require "sqlite3/encoding"
require "sqlite3/database"
@@ -1,13 +1,28 @@
-require "ffi"
-
module SQLite3
module Driver
module FFI
module API
extend ::FFI::Library
- ffi_lib "libsqlite3.so"
+ ffi_lib case RUBY_PLATFORM.downcase
+ when /darwin/
+ "libsqlite3.dylib"
+ when /linux|freebsd|netbsd|openbsd|dragonfly|solaris/
+ "libsqlite3.so"
+ when /win32/
+ "sqlite3.dll"
+ else
+ abort <<-EOF
+==== UNSUPPORTED PLATFORM ======================================================
+The platform '#{RUBY_PLATFORM}' is unsupported. Please help the author by
+editing the following file to allow your sqlite3 library to be found, and
+submitting a patch to qoobaa@gmail.com. Thanks!
+
+#{__FILE__}
+================================================================================
+ EOF
+ end
attach_function :sqlite3_libversion, [], :string
attach_function :sqlite3_open, [:string, :pointer], :int
@@ -1,5 +1,3 @@
-require "sqlite3/constants"
-
module SQLite3
class Exception < ::StandardError
@@ -1,5 +1,3 @@
-require "sqlite3/errors"
-
module SQLite3
# This module is intended for inclusion solely by the Database class. It
@@ -1,6 +1,3 @@
-require "sqlite3/constants"
-require "sqlite3/errors"
-
module SQLite3
# The ResultSet object encapsulates the enumerability of a query's output.
@@ -1,6 +1,3 @@
-require "sqlite3/errors"
-require "sqlite3/resultset"
-
module SQLite3
# A statement represents a prepared-but-unexecuted SQL query. It will rarely
@@ -1,6 +1,3 @@
-require "time"
-require "date"
-
module SQLite3
# The Translator class encapsulates the logic and callbacks necessary for
@@ -1,5 +1,3 @@
-require "sqlite3/constants"
-
module SQLite3
class Value
@@ -24,7 +24,6 @@ def test_database_closing
assert @db.closed?
end
-
def test_encoding_conversion_from_utf_16_to_utf_8
expected_string = "test"
db_filename = "test_database_encoding.db"

0 comments on commit b5f6215

Please sign in to comment.