do_sqlite3 0.9.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/Manifest.txt +15 -4
- data/Rakefile +7 -207
- data/ext/do_sqlite3_ext/do_sqlite3_ext.c +187 -71
- data/ext/do_sqlite3_ext/extconf.rb +2 -0
- data/lib/do_sqlite3/version.rb +1 -1
- data/spec/command_spec.rb +8 -0
- data/spec/connection_spec.rb +18 -0
- data/spec/lib/rspec_immediate_feedback_formatter.rb +3 -0
- data/spec/reader_spec.rb +8 -0
- data/spec/result_spec.rb +9 -0
- data/spec/spec_helper.rb +88 -17
- data/spec/typecast/array_spec.rb +8 -0
- data/spec/typecast/bigdecimal_spec.rb +8 -0
- data/spec/typecast/boolean_spec.rb +8 -0
- data/spec/typecast/byte_array_spec.rb +9 -0
- data/spec/typecast/class_spec.rb +8 -0
- data/spec/typecast/date_spec.rb +8 -0
- data/spec/typecast/datetime_spec.rb +8 -0
- data/spec/typecast/float_spec.rb +8 -0
- data/spec/typecast/integer_spec.rb +8 -0
- data/spec/typecast/nil_spec.rb +10 -0
- data/spec/typecast/range_spec.rb +8 -0
- data/spec/typecast/string_spec.rb +8 -0
- data/spec/typecast/time_spec.rb +8 -0
- data/tasks/gem.rake +61 -0
- data/tasks/install.rake +15 -0
- data/tasks/native.rake +35 -0
- data/tasks/release.rake +75 -0
- data/tasks/retrieve.rake +104 -0
- data/tasks/spec.rake +18 -0
- metadata +71 -39
- data/.gitignore +0 -3
- data/buildfile +0 -27
- data/ext-java/src/main/java/DoSqlite3ExtService.java +0 -23
- data/ext-java/src/main/java/do_sqlite3/Sqlite3DriverDefinition.java +0 -26
- data/spec/integration/do_sqlite3_spec.rb +0 -278
- data/spec/integration/logging_spec.rb +0 -53
- data/spec/integration/quoting_spec.rb +0 -23
- data/spec/spec.opts +0 -2
- data/spec/unit/transaction_spec.rb +0 -34
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
3
|
-
|
4
|
-
describe DataObjects::Sqlite3::Command do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@connection = DataObjects::Connection.new("sqlite3://#{File.expand_path(File.dirname(__FILE__))}/test.db")
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
@connection.close
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "Executing a Reader" do
|
15
|
-
|
16
|
-
it "should log reader queries when the level is Debug (0)" do
|
17
|
-
pending "SQLiteJDBC does not implement java.sql.Statement#toString" if JRUBY
|
18
|
-
command = @connection.create_command("SELECT * FROM users")
|
19
|
-
@mock_logger = mock('MockLogger', :level => 0)
|
20
|
-
DataObjects::Sqlite3.should_receive(:logger).and_return(@mock_logger)
|
21
|
-
@mock_logger.should_receive(:debug).with(/\([\d.]+\) SELECT \* FROM users/)
|
22
|
-
command.execute_reader.close
|
23
|
-
end
|
24
|
-
|
25
|
-
it "shouldn't log reader queries when the level isn't Debug (0)" do
|
26
|
-
command = @connection.create_command("SELECT * FROM users")
|
27
|
-
@mock_logger = mock('MockLogger', :level => 1)
|
28
|
-
DataObjects::Sqlite3.should_receive(:logger).and_return(@mock_logger)
|
29
|
-
@mock_logger.should_not_receive(:debug)
|
30
|
-
command.execute_reader.close
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "Executing a Non-Query" do
|
35
|
-
it "should log non-query statements when the level is Debug (0)" do
|
36
|
-
pending "SQLiteJDBC does not implement java.sql.Statement#toString" if JRUBY
|
37
|
-
command = @connection.create_command("INSERT INTO users (name) VALUES (?)")
|
38
|
-
@mock_logger = mock('MockLogger', :level => 0)
|
39
|
-
DataObjects::Sqlite3.should_receive(:logger).and_return(@mock_logger)
|
40
|
-
@mock_logger.should_receive(:debug).with(/\([\d.]+\) INSERT INTO users \(name\) VALUES \('Blah'\)/)
|
41
|
-
command.execute_non_query('Blah')
|
42
|
-
end
|
43
|
-
|
44
|
-
it "shouldn't log non-query statements when the level isn't Debug (0)" do
|
45
|
-
command = @connection.create_command("INSERT INTO users (name) VALUES (?)")
|
46
|
-
@mock_logger = mock('MockLogger', :level => 1)
|
47
|
-
DataObjects::Sqlite3.should_receive(:logger).and_return(@mock_logger)
|
48
|
-
@mock_logger.should_not_receive(:debug)
|
49
|
-
command.execute_non_query('Blah')
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
3
|
-
|
4
|
-
unless JRUBY
|
5
|
-
|
6
|
-
describe DataObjects::Sqlite3::Command do
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@connection = DataObjects::Connection.new("sqlite3://#{File.expand_path(File.dirname(__FILE__))}/test.db")
|
10
|
-
@command = @connection.create_command("INSERT INTO users (name) VALUES (?)")
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should properly quote a string" do
|
14
|
-
@command.quote_string("O'Hare").should == "'O''Hare'"
|
15
|
-
@command.quote_string("Willy O'Hare & Johnny O'Toole").should == "'Willy O''Hare & Johnny O''Toole'"
|
16
|
-
@command.quote_string("Billy\\Bob").should == "'Billy\\Bob'"
|
17
|
-
@command.quote_string("The\\Backslasher\\Rises\\Again").should == "'The\\Backslasher\\Rises\\Again'"
|
18
|
-
@command.quote_string("Scott \"The Rage\" Bauer").should == "'Scott \"The Rage\" Bauer'"
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
3
|
-
|
4
|
-
describe DataObjects::Sqlite3::Transaction do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
@connection = mock("connection")
|
8
|
-
DataObjects::Connection.should_receive(:new).with("mock://mock/mock").once.and_return(@connection)
|
9
|
-
@transaction = DataObjects::Sqlite3::Transaction.new("mock://mock/mock")
|
10
|
-
@transaction.id.replace("id")
|
11
|
-
@command = mock("command")
|
12
|
-
end
|
13
|
-
|
14
|
-
{
|
15
|
-
:begin => "BEGIN",
|
16
|
-
:commit => "COMMIT",
|
17
|
-
:rollback => "ROLLBACK",
|
18
|
-
:rollback_prepared => "ROLLBACK",
|
19
|
-
:prepare => nil
|
20
|
-
}.each do |method, commands|
|
21
|
-
it "should execute #{commands.inspect} on ##{method}" do
|
22
|
-
if commands.is_a?(String)
|
23
|
-
@command.should_receive(:execute_non_query).once
|
24
|
-
@connection.should_receive(:create_command).once.with(commands).and_return(@command)
|
25
|
-
@transaction.send(method)
|
26
|
-
elsif commands.nil?
|
27
|
-
@command.should_not_receive(:execute_non_query)
|
28
|
-
@connection.should_not_receive(:create_command)
|
29
|
-
@transaction.send(method)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|