Rubernate 0.1.3 → 0.1.4

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.
@@ -249,7 +249,8 @@ module Queries
249
249
 
250
250
  # Init Param accepts table and name of param
251
251
  def initialize factory, r_object, name
252
- @factory, @r_object, @name, @r_params = factory, r_object, name, [self]
252
+ @factory, @r_object, @name = factory, r_object, name
253
+ @marker, @r_params = [], [self]
253
254
  end
254
255
 
255
256
  # Returns full param table name with object tables prefix
@@ -368,8 +369,8 @@ module Queries
368
369
 
369
370
  # Returns markers used in query in valid order.
370
371
  def markers
371
- to_sql unless @sql
372
- @markers ||= @exprs.inject([]){|result, expr| result.concat expr.markers}
372
+ to_sql
373
+ @markers
373
374
  end
374
375
 
375
376
  # Arranges map: values {marker=>value} to ordered array of values
@@ -384,12 +385,11 @@ module Queries
384
385
  if @query.is_a? String
385
386
  @sql, @markers = @factory.cache[@query]
386
387
  unless @sql
387
- @sql = eval_query
388
- @markers = @exprs.inject([]){|result, expr| result.concat expr.markers}
388
+ @sql, @markers = eval_query
389
389
  @factory.cache[@query] = [@sql, @markers]
390
390
  end
391
391
  else
392
- @sql = eval_query
392
+ @sql, @markers = eval_query
393
393
  end
394
394
  @sql
395
395
  end
@@ -402,7 +402,7 @@ module Queries
402
402
  Log.debug "Translate: <<#{query}>> to sql: <<#{sql}>>"
403
403
  end
404
404
 
405
- # Evaluates query withing the object context.
405
+ # Evaluates query withing the object context. Returns sql, and array of markers: [sql, [m1,m2,..]]
406
406
  def eval_query
407
407
  if @query.is_a? Proc
408
408
  instance_eval(&@query)
@@ -413,7 +413,7 @@ module Queries
413
413
  sql+= "\n\twhere #{where_sql}"
414
414
  sql+= "\n\torder by #{order_by_sql}" unless @order.empty?
415
415
  log_debug_query sql
416
- sql
416
+ [sql, @exprs.inject([]){|result, expr| result.concat expr.markers}]
417
417
  end
418
418
 
419
419
  # Generates where clause for each expression joined by and clause
@@ -429,11 +429,19 @@ module Queries
429
429
 
430
430
  # Generates left outer join for each r_params used in query
431
431
  def tables_sql
432
- r_objects.collect{|r_object| 'r_objects ' + r_object.to_sql}.join(', ') +
433
- r_params.collect{|r_param|
434
- "\n\tleft outer join r_params " + r_param.to_sql +
435
- ' on (' + r_param.r_object.to_sql + '.object_pk = ' + r_param.to_sql + '.object_pk)'
436
- }.join()
432
+ r_joins = {}
433
+ r_objects.each{|r_o| r_joins[r_o.to_sql] ||= []} # Collect all r_objects used in query
434
+ r_params.each{|r_p| r_joins[r_p.r_object.to_sql] << r_p.to_sql} #Join all r_params to r_objects
435
+
436
+ result = nil
437
+ for obj, params in r_joins
438
+ result = result ? result << ",\n\t\t" : ''
439
+ result << 'r_objects ' + obj
440
+ for param in params
441
+ result << " left outer join r_params #{param} on (#{obj}.object_pk = #{param}.object_pk)"
442
+ end
443
+ end
444
+ result
437
445
  end
438
446
 
439
447
  # Retruns r_params used in query. List of RParam.
data/tests/all_tests.rb CHANGED
@@ -8,5 +8,13 @@ require 'rubernate/utils_test'
8
8
  require 'rubernate/queries_test'
9
9
  require 'rubernate/impl/memory_test'
10
10
  require 'rubernate/callbacks_test'
11
- require 'rubernate/impl/dbi_oracle_test' if $run_oracle_tests
12
- require 'rubernate/impl/dbi_mysql_test' if $run_mysql_tests
11
+
12
+ if $run_oracle_tests
13
+ require 'rubernate/impl/queries_oracle_test'
14
+ require 'rubernate/impl/dbi_oracle_test'
15
+ end
16
+
17
+ if $run_mysql_tests
18
+ require 'rubernate/impl/queries_mysql_test'
19
+ require 'rubernate/impl/dbi_mysql_test'
20
+ end
@@ -8,16 +8,24 @@ require 'test/unit'
8
8
 
9
9
  module FixtureClasses
10
10
  class C0; attr :p0, false end
11
- class C1; persistent :p1; end
11
+ class C1
12
+ persistent :p1
13
+ def to_s
14
+ "#{self.class}:#{primary_key}"
15
+ end
16
+ end
12
17
  class C2 < C1; persistent :p2; end
13
- class C3 < C0;
18
+ class C3 < C0
14
19
  persistent :p0
15
20
  def on_load
16
21
  Thread.current[:on_load] = self
17
22
  end
18
23
  def on_save
19
24
  Thread.current[:on_save] = self
20
- end
25
+ end
26
+ def to_s
27
+ "#{self.class}:#{primary_key}"
28
+ end
21
29
  end
22
30
  class C4 < C2
23
31
  def initialize pk = nil
@@ -26,5 +34,8 @@ module FixtureClasses
26
34
  end
27
35
  class Full
28
36
  persistent :p_nil, :p_int, :p_float, :p_str, :p_date, :p_time, :p_array, :p_hash
37
+ def to_s
38
+ "#{self.class}:#{primary_key}"
39
+ end
29
40
  end
30
41
  end
@@ -0,0 +1,15 @@
1
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
2
+ $:.include?(File.expand_path('../../..', __FILE__))
3
+
4
+ require 'rubernate/fixtures'
5
+ require 'rubernate/impl/queries_stub'
6
+
7
+ module Rubernate
8
+ class MysqlQueriesTest < Test::Unit::TestCase
9
+ include GenericQueriesTest
10
+ def setup
11
+ init :mysql, MYSQL_DB_URL, MYSQL_DB_USER, MYSQL_DB_PWD
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,16 @@
1
+
2
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
3
+ $:.include?(File.expand_path('../../..', __FILE__))
4
+
5
+ require 'rubernate/fixtures'
6
+ require 'rubernate/impl/queries_stub'
7
+
8
+ module Rubernate
9
+ class OracleQueriesTest < Test::Unit::TestCase
10
+ include GenericQueriesTest
11
+ def setup
12
+ init :oracle, ORA_DB_URL, ORA_DB_USER, ORA_DB_PWD
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,72 @@
1
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
2
+ $:.include?(File.expand_path('../../..', __FILE__))
3
+
4
+ require 'config'
5
+ require 'rubernate/fixtures'
6
+
7
+ module Rubernate
8
+ module GenericQueriesTest
9
+ include Rubernate
10
+ include FixtureClasses
11
+
12
+ def init db_type, db_url, db_user, db_password
13
+ Rubernate.config db_type, db_url, db_user, db_password
14
+ Rubernate.session do |rt|
15
+ rt.dbh.do 'delete from r_params'
16
+ rt.dbh.do 'delete from r_objects'
17
+ end
18
+ end
19
+
20
+ def teardown
21
+ @runtime.dbh.disconnect if @runtime and @runtime.dbh
22
+ end
23
+
24
+ def test_find_by_param_value
25
+ Rubernate.session do
26
+ o = C1.new.attach
27
+ # Test string value
28
+ o.p1 = 'tv1'
29
+ res = find_by_query 'Select :o; Where o.p1.str == :value', :value => 'tv1'
30
+ assert_equal [o], res
31
+ # Test int value
32
+ o.p1 = 123
33
+ res = find_by_query 'Select :o; Where o.p1.int == :value', :value => 123
34
+ assert_equal [o], res
35
+ # Test date value
36
+ date = Date.today
37
+ o.p1 = date
38
+ res = find_by_query 'Select :o; Where o.p1.date == :value', :value => date
39
+ assert_equal [o], res
40
+ # Test time value
41
+ time = Time.now
42
+ o.p1 = time
43
+ res = find_by_query 'Select :o; Where o.p1.time == :value', :value => time
44
+ assert_equal [o], res
45
+ # Test ref value
46
+ o.p1 = o
47
+ res = find_by_query 'Select :o; Where o.p1.ref == :value', :value => o
48
+ assert_equal [o], res
49
+ end
50
+ end
51
+
52
+ def test_eq_two_props
53
+ Rubernate.session do
54
+ o1, o2 = C2.new.attach, C2.new.attach
55
+ o1.p1, o1.p2 = 1, 2
56
+ o2.p1, o2.p2 = 3, 3
57
+ res = find_by_query 'Select :o; Where o.p1.int == o.p2.int, o.p2.int >= 2'
58
+ assert_equal [o2], res
59
+ end
60
+ end
61
+
62
+ def test_ref_on_other
63
+ Rubernate.session do
64
+ o1, o2 = C2.new.attach, C2.new.attach
65
+ o1.p1 = o2
66
+ o2.p1 = 'test'
67
+ res = find_by_query 'Select :o1, :o2; Where o1.p1.ref == o2, o2.p1.str == :v', :v => 'test'
68
+ assert_equal [o1], res
69
+ end
70
+ end
71
+ end
72
+ end
@@ -3,174 +3,187 @@ $:.unshift(File.expand_path('../..', __FILE__)) unless
3
3
 
4
4
  require 'rubernate/fixtures'
5
5
 
6
- class Rubernate::QueriesGenericTest < Test::Unit::TestCase
7
- include Rubernate::Queries
8
- include FixtureClasses
9
-
10
- def setup
11
- @factory = Factory.new
12
- end
13
-
14
- def query *q_text, &q_block
15
- if block_given?
16
- @factory.query(&q_block)
17
- else
18
- @factory.query q_text[0]
6
+ module Rubernate
7
+ class QueryBuildTest < Test::Unit::TestCase
8
+ include Rubernate::Queries
9
+ include FixtureClasses
10
+
11
+ def setup
12
+ @factory = Factory.new
19
13
  end
20
- end
21
14
 
22
- def once str, substr
23
- lidx, ridx = str.index(substr), str.rindex(substr)
24
- lidx and lidx == ridx
25
- end
15
+ def query *q_text, &q_block
16
+ if block_given?
17
+ @factory.query(&q_block)
18
+ else
19
+ @factory.query q_text[0]
20
+ end
21
+ end
22
+
23
+ def once str, substr
24
+ lidx, ridx = str.index(substr), str.rindex(substr)
25
+ lidx and lidx == ridx
26
+ end
26
27
 
27
- def assert_once string, tokens
28
- tokens = [tokens] unless tokens.is_a? Array
29
- for token in tokens
30
- assert once(string, token), "'#{token}' must occurse only once in \n'#{string}'"
28
+ def assert_once string, tokens
29
+ tokens = [tokens] unless tokens.is_a? Array
30
+ for token in tokens
31
+ assert once(string, token), "'#{token}' must occurse only once in \n'#{string}'"
32
+ end
33
+ end
34
+
35
+ def test_query_simplest
36
+ q = query 'Select :o; Where o.p1.int == 1'
37
+ sql = q.to_sql.downcase
38
+ assert_once sql, [ 'select o_.* from', 'r_objects o_', 'r_params o_p1',
39
+ 'o_.object_pk = o_p1.object_pk', 'o_p1.name = \'p1\'']
40
+ end
41
+
42
+ def test_query_join_by_int
43
+ q = query "Select :o, :p; Where(o.p1.int == p.p2.int)"
44
+ sql = q.to_sql.downcase
45
+ assert_once sql, [ 'r_objects p_', 'r_params p_p2', 'r_objects o_', 'r_params o_p1',
46
+ 'o_.object_pk = o_p1.object_pk', 'p_.object_pk = p_p2.object_pk',
47
+ 'o_p1.int_value = p_p2.int_value', 'o_p1.name = \'p1\'',
48
+ 'p_p2.name = \'p2\'' ]
49
+ end
50
+
51
+ def test_query_filter_by_int
52
+ q = query {Select :o; Where(o.p1.int == 1)}
53
+ sql = q.to_sql.downcase
54
+ assert_once sql, ['o_p1.int_value = 1', 'o_p1.name = \'p1\'']
31
55
  end
32
- end
33
-
34
- def test_query_simplest
35
- q = query 'Select :o; Where o.p1.int == 1'
36
- sql = q.to_sql.downcase
37
- assert_once sql, [ 'select o_.* from', 'r_objects o_', 'r_params o_p1',
38
- 'o_.object_pk = o_p1.object_pk', 'o_p1.name = \'p1\'']
39
- end
40
-
41
- def test_query_join_by_int
42
- q = query "Select :o, :p; Where(o.p1.int == p.p2.int)"
43
- sql = q.to_sql.downcase
44
- assert_once sql, [ 'r_objects p_', 'r_params p_p2', 'r_objects o_', 'r_params o_p1',
45
- 'o_.object_pk = o_p1.object_pk', 'p_.object_pk = p_p2.object_pk',
46
- 'o_p1.int_value = p_p2.int_value', 'o_p1.name = \'p1\'',
47
- 'p_p2.name = \'p2\'' ]
48
- end
49
-
50
- def test_query_filter_by_int
51
- q = query {Select :o; Where(o.p1.int == 1)}
52
- sql = q.to_sql.downcase
53
- assert_once sql, ['o_p1.int_value = 1', 'o_p1.name = \'p1\'']
54
- end
55
56
 
56
- def test_query_filter_by_nil
57
- q = query 'Select :o; Where(o.p1.int.is_nil)'
58
- sql = q.to_sql.downcase
59
- assert_once sql, ['o_p1.int_value is null', 'o_p1.name = \'p1\'']
60
- q = query 'Select :o; Where(o.p1.int.is_not_nil)'
61
- sql = q.to_sql.downcase
62
- assert_once sql, ['o_p1.int_value is not null']
63
- end
64
-
65
- def test_query_and
66
- q = query 'Select :o; Where And(o.p1.int == 1, o.p2.int == 2)'
67
- sql = q.to_sql.downcase
68
- assert_once sql, ['o_p1.int_value = 1', 'o_.object_pk = o_p2.object_pk']
69
- end
57
+ def test_query_filter_by_nil
58
+ q = query 'Select :o; Where(o.p1.int.is_nil)'
59
+ sql = q.to_sql.downcase
60
+ assert_once sql, ['o_p1.int_value is null', 'o_p1.name = \'p1\'']
61
+ q = query 'Select :o; Where(o.p1.int.is_not_nil)'
62
+ sql = q.to_sql.downcase
63
+ assert_once sql, ['o_p1.int_value is not null']
64
+ end
65
+
66
+ def test_query_and
67
+ q = query 'Select :o; Where And(o.p1.int == 1, o.p2.int == 2)'
68
+ sql = q.to_sql.downcase
69
+ assert_once sql, ['o_p1.int_value = 1', 'o_.object_pk = o_p2.object_pk']
70
+ end
70
71
 
71
- def test_query_less_greater
72
- q = query 'Select :o; Where And(o.p1.int < 1, o.p2.int > 2)'
73
- sql = q.to_sql.downcase
74
- assert_once sql, ['o_p1.int_value < 1', 'o_p2.int_value > 2']
75
- end
72
+ def test_query_less_greater
73
+ q = query 'Select :o; Where And(o.p1.int < 1, o.p2.int > 2)'
74
+ sql = q.to_sql.downcase
75
+ assert_once sql, ['o_p1.int_value < 1', 'o_p2.int_value > 2']
76
+ end
76
77
 
77
- def test_query_or
78
- q = query 'Select :o; Where (Or o.p1.int == 1, o.p2.int == 2)'
79
- sql = q.to_sql.downcase
80
- assert_once sql, ['o_p1.int_value = 1', 'o_p1.int_value = 1', 'or']
81
- end
82
-
83
- def test_query_and_or
84
- q = query 'Select :o; Where Or((And o.p1.int == 1, o.p2.int == 2), (o.p1.int == 3))'
85
- sql = q.to_sql.downcase
86
- assert_once sql, ['o_p1.int_value = 1', 'o_p2.int_value = 2', 'o_p1.int_value = 3', 'or']
87
- end
88
-
89
- def test_query_ref_equality
90
- q = query 'Select :o, :t; Where Or(o.p1 == t, t.p2.int > 10)'
91
- sql = q.to_sql.downcase
92
- assert_once sql, 'o_p1.ref_value = t_.object_pk'
93
- end
94
-
95
- def test_query_is_int
96
- q = query {Select :o; Where o.p1.is_int}
97
- sql = q.to_sql.downcase
98
- assert_once sql, 'o_p1.flags = 1'
99
- end
100
-
101
- def test_array_index
102
- q = query {Select :o, :t; Where(o.p[3] == t)}
103
- sql = q.to_sql.downcase
104
- assert_once sql, ['o_.object_pk = o_p.object_pk', 'o_p.int_value = 3',
105
- 'o_p.ref_value = t_.object_pk']
106
- end
78
+ def test_query_or
79
+ q = query 'Select :o; Where (Or o.p1.int == 1, o.p2.int == 2)'
80
+ sql = q.to_sql.downcase
81
+ assert_once sql, ['o_p1.int_value = 1', 'o_p1.int_value = 1', 'or']
82
+ end
83
+
84
+ def test_query_and_or
85
+ q = query 'Select :o; Where Or((And o.p1.int == 1, o.p2.int == 2), (o.p1.int == 3))'
86
+ sql = q.to_sql.downcase
87
+ assert_once sql, ['o_p1.int_value = 1', 'o_p2.int_value = 2', 'o_p1.int_value = 3', 'or']
88
+ end
89
+
90
+ def test_query_ref_equality
91
+ q = query 'Select :o, :t; Where Or(o.p1 == t, t.p2.int > 10)'
92
+ sql = q.to_sql.downcase
93
+ assert_once sql, 'o_p1.ref_value = t_.object_pk'
94
+ end
95
+
96
+ def test_query_is_int
97
+ q = query {Select :o; Where o.p1.is_int}
98
+ sql = q.to_sql.downcase
99
+ assert_once sql, 'o_p1.flags = 1'
100
+ end
101
+
102
+ def test_array_index
103
+ q = query {Select :o, :t; Where(o.p[3] == t)}
104
+ sql = q.to_sql.downcase
105
+ assert_once sql, ['o_.object_pk = o_p.object_pk', 'o_p.int_value = 3',
106
+ 'o_p.ref_value = t_.object_pk']
107
+ end
107
108
 
108
- def test_array_param_index
109
- q = query {Select :o, :t; Where(o.p[:index] == t)}
110
- sql = q.to_sql.downcase
111
- assert_once sql, ['o_.object_pk = o_p.object_pk', 'o_p.int_value = ?',
112
- 'o_p.ref_value = t_.object_pk']
113
- end
114
-
115
- def test_not_expr
116
- q = query {Select :o; Where(Not(o.p.int == 1))}
117
- sql = q.to_sql.downcase
118
- assert_once sql, 'not (o_p.int_value = 1)'
119
- end
120
-
121
- def test_markers
122
- q = query {Select :o; Where(o.p1.int == :v1, o.p2 == :r2)}
123
- sql = q.to_sql.downcase
124
- assert_once sql, ['o_p1.int_value = ?', 'o_p2.ref_value = ?']
125
- assert_equal [:v1, :r2], q.markers
126
- end
127
-
128
- def test_no_markers
129
- q = query {Select :o; Where(o.p1.int == 1)}
130
- assert_equal [], q.markers
131
- end
132
-
133
- def test_class_equal
134
- q = query {Select :o; Where(o.klass == C1)}
135
- sql = q.to_sql
136
- assert_once sql, ['r_objects o', 'o_.object_class = \'FixtureClasses::C1\'']
137
- end
138
-
139
- def test_expr_in
140
- q = query {Select :o; Where(In(o.p1.int, [1, 2, 3]))}
141
- sql = q.to_sql.downcase
142
- assert_once sql, 'o_p1.int_value in (1, 2, 3)'
143
- end
144
-
145
- def test_order_by
146
- q = query {Select :o; Where o.klass == C1; OrderBy o.p1.int}
147
- sql = q.to_sql.downcase
148
- assert_once sql, 'order by o_p1.int_value'
149
- end
150
-
151
- def test_in_subclasses
152
- q = query 'Select :o; Where In(o.klass, FixtureClasses::C1.subclasses)'
153
- assert_once q.to_sql, %w{o_.object_class FixtureClasses::C2 FixtureClasses::C4}
154
- end
155
-
156
- def test_derived
157
- q = query 'Select :o; Where o.derived(FixtureClasses::C1)'
158
- q.to_sql
159
- assert_once q.to_sql, %w{FixtureClasses::C1 FixtureClasses::C2 FixtureClasses::C4}
160
-
161
- q = query 'Select :o; Where o.derived(FixtureClasses::C4)'
162
- assert_once q.to_sql, %w{FixtureClasses::C4}
163
- end
164
-
165
- def test_param_name
166
- q = query {Select :o; Where o.name.str == :name}
167
- assert_once q.to_sql, ["o_name.name = 'name'", 'o_name.str_value = ?']
109
+ def test_array_param_index
110
+ q = query {Select :o, :t; Where(o.p[:index] == t)}
111
+ sql = q.to_sql.downcase
112
+ assert_once sql, ['o_.object_pk = o_p.object_pk', 'o_p.int_value = ?',
113
+ 'o_p.ref_value = t_.object_pk']
114
+ end
115
+
116
+ def test_not_expr
117
+ q = query {Select :o; Where(Not(o.p.int == 1))}
118
+ sql = q.to_sql.downcase
119
+ assert_once sql, 'not (o_p.int_value = 1)'
120
+ end
121
+
122
+ def test_markers
123
+ q = query {Select :o; Where(o.p1.int == :v1, o.p2 == :r2)}
124
+ sql = q.to_sql.downcase
125
+ assert_once sql, ['o_p1.int_value = ?', 'o_p2.ref_value = ?']
126
+ assert_equal [:v1, :r2], q.markers
127
+ end
128
+
129
+ def test_no_markers
130
+ q = query {Select :o; Where(o.p1.int == 1)}
131
+ assert_equal [], q.markers
132
+ end
133
+
134
+ def test_class_equal
135
+ q = query {Select :o; Where(o.klass == C1)}
136
+ sql = q.to_sql
137
+ assert_once sql, ['r_objects o', 'o_.object_class = \'FixtureClasses::C1\'']
138
+ end
139
+
140
+ def test_expr_in
141
+ q = query {Select :o; Where(In(o.p1.int, [1, 2, 3]))}
142
+ sql = q.to_sql.downcase
143
+ assert_once sql, 'o_p1.int_value in (1, 2, 3)'
144
+ end
145
+
146
+ def test_order_by
147
+ q = query {Select :o; Where o.klass == C1; OrderBy o.p1.int}
148
+ sql = q.to_sql.downcase
149
+ assert_once sql, 'order by o_p1.int_value'
150
+ end
151
+
152
+ def test_in_subclasses
153
+ q = query 'Select :o; Where In(o.klass, FixtureClasses::C1.subclasses)'
154
+ assert_once q.to_sql, %w{o_.object_class FixtureClasses::C2 FixtureClasses::C4}
155
+ end
156
+
157
+ def test_derived
158
+ q = query 'Select :o; Where o.derived(FixtureClasses::C1)'
159
+ q.to_sql
160
+ assert_once q.to_sql, %w{FixtureClasses::C1 FixtureClasses::C2 FixtureClasses::C4}
161
+
162
+ q = query 'Select :o; Where o.derived(FixtureClasses::C4)'
163
+ assert_once q.to_sql, %w{FixtureClasses::C4}
164
+ end
165
+
166
+ def test_param_name
167
+ q = query {Select :o; Where o.name.str == :name}
168
+ assert_once q.to_sql, ["o_name.name = 'name'", 'o_name.str_value = ?']
169
+ end
170
+
171
+ def test_eq_equivalence
172
+ q0 = query {Select :o; Where o.p1 == :ref}
173
+ q1 = query {Select :o; Where Eq(o.p1, :ref)}
174
+ assert_equal q0.to_sql, q1.to_sql
175
+ assert_equal q0.markers, q1.markers
176
+ end
177
+
178
+ def test_cache
179
+ q = query 'Select :o; Where o.p1.int == 1'
180
+ sql = q.to_sql
181
+ mrk = q.markers
182
+ 10.times do
183
+ q = query 'Select :o; Where o.p1.int == 1'
184
+ assert_equal sql, q.to_sql
185
+ assert_equal mrk, q.markers
186
+ end
187
+ end
168
188
  end
169
-
170
- def test_eq_equivalence
171
- q0 = query {Select :o; Where o.p1 == :ref}
172
- q1 = query {Select :o; Where Eq(o.p1, :ref)}
173
- assert_equal q0.to_sql, q1.to_sql
174
- assert_equal q0.markers, q1.markers
175
- end
176
189
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: Rubernate
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.3
7
- date: 2006-03-13 00:00:00 +03:00
6
+ version: 0.1.4
7
+ date: 2006-03-16 00:00:00 +03:00
8
8
  summary: Object-oriented storage for Ruby objects based on relational database model
9
9
  require_paths:
10
10
  - lib
@@ -58,6 +58,9 @@ files:
58
58
  - tests/rubernate/impl/dbi_mysql_test.rb
59
59
  - tests/rubernate/impl/dbi_oracle_test.rb
60
60
  - tests/rubernate/impl/memory_test.rb
61
+ - tests/rubernate/impl/queries_mysql_test.rb
62
+ - tests/rubernate/impl/queries_oracle_test.rb
63
+ - tests/rubernate/impl/queries_stub.rb
61
64
  - README
62
65
  test_files:
63
66
  - tests/all_tests.rb