activetokyocabinet 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -134,9 +134,20 @@ module ActiveRecord
|
|
134
134
|
parsed_sql = ActiveTokyoCabinet::SQLParser.new(sql).parse
|
135
135
|
|
136
136
|
tdbopen(parsed_sql[:table]) do |tdb|
|
137
|
-
|
138
|
-
|
139
|
-
|
137
|
+
condition = parsed_sql[:condition] || []
|
138
|
+
|
139
|
+
unless cond?(condition)
|
140
|
+
[condition].flatten.each do |rkey|
|
141
|
+
unless tdb.out(rkey)
|
142
|
+
ecode = tdb.ecode
|
143
|
+
raise '%s: %s' % [tdb.errmsg(ecode), sql]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else
|
147
|
+
unless query(tdb, parsed_sql).searchout
|
148
|
+
ecode = tdb.ecode
|
149
|
+
raise '%s: %s' % [tdb.errmsg(ecode), sql]
|
150
|
+
end
|
140
151
|
end
|
141
152
|
end
|
142
153
|
end
|
data/spec/tcspec2ttspec.sh
CHANGED
File without changes
|
data/spec/tokyocabinet_spec.rb
CHANGED
@@ -475,6 +475,38 @@ describe 'tokyocabinet:' do
|
|
475
475
|
end
|
476
476
|
end
|
477
477
|
|
478
|
+
it "destroy employee" do
|
479
|
+
Employee.count.should == 17
|
480
|
+
employee = Employee.find(:first, :conditions => {:ename => 'KING'})
|
481
|
+
employee_id = employee.id
|
482
|
+
Employee.find(employee_id).should_not be_nil
|
483
|
+
employee.destroy
|
484
|
+
Employee.count.should == 16
|
485
|
+
Employee.find_by_id(employee_id).should be_nil
|
486
|
+
end
|
487
|
+
|
488
|
+
it "destroy all employee" do
|
489
|
+
Employee.count.should == 17
|
490
|
+
Employee.destroy_all
|
491
|
+
Employee.count.should == 0
|
492
|
+
end
|
493
|
+
|
494
|
+
it "delete department" do
|
495
|
+
Department.count.should == 5
|
496
|
+
department = Department.find(:first, :conditions => {:dname => 'SALES'})
|
497
|
+
department_id = department.id
|
498
|
+
Department.find(department_id).should_not be_nil
|
499
|
+
department.delete
|
500
|
+
Department.count.should == 4
|
501
|
+
Department.find_by_id(department_id).should be_nil
|
502
|
+
end
|
503
|
+
|
504
|
+
it "delete all department" do
|
505
|
+
Department.count.should == 5
|
506
|
+
Department.delete_all
|
507
|
+
Department.count.should == 0
|
508
|
+
end
|
509
|
+
|
478
510
|
after do
|
479
511
|
TokyoCabinetSpec.clean
|
480
512
|
end
|
data/spec/tokyotyrant_spec.rb
CHANGED
@@ -475,6 +475,38 @@ describe 'tokyotyrant:' do
|
|
475
475
|
end
|
476
476
|
end
|
477
477
|
|
478
|
+
it "destroy employee" do
|
479
|
+
Employee.count.should == 17
|
480
|
+
employee = Employee.find(:first, :conditions => {:ename => 'KING'})
|
481
|
+
employee_id = employee.id
|
482
|
+
Employee.find(employee_id).should_not be_nil
|
483
|
+
employee.destroy
|
484
|
+
Employee.count.should == 16
|
485
|
+
Employee.find_by_id(employee_id).should be_nil
|
486
|
+
end
|
487
|
+
|
488
|
+
it "destroy all employee" do
|
489
|
+
Employee.count.should == 17
|
490
|
+
Employee.destroy_all
|
491
|
+
Employee.count.should == 0
|
492
|
+
end
|
493
|
+
|
494
|
+
it "delete department" do
|
495
|
+
Department.count.should == 5
|
496
|
+
department = Department.find(:first, :conditions => {:dname => 'SALES'})
|
497
|
+
department_id = department.id
|
498
|
+
Department.find(department_id).should_not be_nil
|
499
|
+
department.delete
|
500
|
+
Department.count.should == 4
|
501
|
+
Department.find_by_id(department_id).should be_nil
|
502
|
+
end
|
503
|
+
|
504
|
+
it "delete all department" do
|
505
|
+
Department.count.should == 5
|
506
|
+
Department.delete_all
|
507
|
+
Department.count.should == 0
|
508
|
+
end
|
509
|
+
|
478
510
|
after do
|
479
511
|
TokyoTyrantSpec.clean
|
480
512
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activetokyocabinet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-27 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|