sqlite3 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/VERSION +1 -1
- data/lib/sqlite3/database.rb +0 -4
- data/lib/sqlite3/driver/ffi/api.rb +1 -18
- data/test/test_active_record.rb +37 -0
- metadata +3 -3
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/sqlite3/database.rb
CHANGED
@@ -53,10 +53,6 @@ module SQLite3
|
|
53
53
|
# as hashes or not. By default, rows are returned as arrays.
|
54
54
|
attr_accessor :results_as_hash
|
55
55
|
|
56
|
-
# A boolean indicating whether or not type translation is enabled for this
|
57
|
-
# database.
|
58
|
-
# attr_accessor :type_translation
|
59
|
-
|
60
56
|
# Encoding used to comunicate with database.
|
61
57
|
attr_reader :encoding
|
62
58
|
|
@@ -6,24 +6,7 @@ module SQLite3
|
|
6
6
|
extend ::FFI::Library
|
7
7
|
|
8
8
|
# TODO: cleanup
|
9
|
-
ffi_lib
|
10
|
-
when /darwin/
|
11
|
-
"libsqlite3.dylib"
|
12
|
-
when /linux|freebsd|netbsd|openbsd|dragonfly|solaris/
|
13
|
-
"libsqlite3.so"
|
14
|
-
when /win|mingw/
|
15
|
-
"sqlite3.dll"
|
16
|
-
else
|
17
|
-
abort <<-EOF
|
18
|
-
==== UNSUPPORTED PLATFORM ======================================================
|
19
|
-
The platform '#{RUBY_PLATFORM}' is unsupported. Please help the author by
|
20
|
-
editing the following file to allow your sqlite3 library to be found, and
|
21
|
-
submitting a patch to qoobaa@gmail.com. Thanks!
|
22
|
-
|
23
|
-
#{__FILE__}
|
24
|
-
================================================================================
|
25
|
-
EOF
|
26
|
-
end
|
9
|
+
ffi_lib "libsqlite3.dylib", "libsqlite3.so" "sqlite3.dll"
|
27
10
|
|
28
11
|
attach_function :sqlite3_libversion, [], :string
|
29
12
|
attach_function :sqlite3_open, [:string, :pointer], :int
|
data/test/test_active_record.rb
CHANGED
@@ -109,4 +109,41 @@ class TestActiveRecord < Test::Unit::TestCase
|
|
109
109
|
assert_equal "alice", user.login
|
110
110
|
assert_equal "bob", user.login_was
|
111
111
|
end
|
112
|
+
|
113
|
+
def test_transaction_commit
|
114
|
+
User.transaction do
|
115
|
+
User.create!
|
116
|
+
end
|
117
|
+
assert_equal 1, User.count
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_transaction_rollback
|
121
|
+
User.transaction do
|
122
|
+
User.create!
|
123
|
+
raise ActiveRecord::Rollback
|
124
|
+
end
|
125
|
+
assert_equal 0, User.count
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_reload
|
129
|
+
User.create!(:login => "bob")
|
130
|
+
user = User.first
|
131
|
+
assert_equal "bob", user.login
|
132
|
+
user.login = "alice"
|
133
|
+
assert_equal "alice", user.login
|
134
|
+
user.reload
|
135
|
+
assert_equal "bob", user.login
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_save
|
139
|
+
user = User.new(:login => "alice")
|
140
|
+
user.save
|
141
|
+
assert_equal 1, User.count
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_save_with_bang
|
145
|
+
user = User.new(:login => "alice")
|
146
|
+
user.save!
|
147
|
+
assert_equal 1, User.count
|
148
|
+
end
|
112
149
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jakub Ku\xC5\xBAma"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-04 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -114,7 +114,7 @@ specification_version: 3
|
|
114
114
|
summary: SQLite3 FFI bindings for Ruby 1.9
|
115
115
|
test_files:
|
116
116
|
- test/test_database_queries_utf_8.rb
|
117
|
-
- test/test_database_queries_utf_16.rb
|
118
117
|
- test/test_active_record.rb
|
118
|
+
- test/test_database_queries_utf_16.rb
|
119
119
|
- test/test_database_initialization.rb
|
120
120
|
- test/helper.rb
|