momomoto 0.2.0 → 0.2.1
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/lib/momomoto/datatype/base.rb +8 -0
- data/lib/momomoto/table.rb +4 -1
- metadata +2 -2
@@ -73,6 +73,14 @@ module Momomoto
|
|
73
73
|
return compile_rule( field_name, value[0] ) if value.length == 1
|
74
74
|
raise Error, "empty array conditions are not allowed for #{field_name}" if value.empty?
|
75
75
|
raise Error, "nil values not allowed in compile_rule for #{field_name}" if value.member?( nil )
|
76
|
+
# do the right thing when NULL is part of an array
|
77
|
+
if value.delete( :NULL )
|
78
|
+
if value.length == 0
|
79
|
+
return compile_rule( field_name, :NULL )
|
80
|
+
else
|
81
|
+
return " (#{compile_rule( field_name, :NULL)} OR #{compile_rule( field_name, value )} ) "
|
82
|
+
end
|
83
|
+
end
|
76
84
|
field_name.to_s + ' IN (' + value.map{ | v | escape(filter_set(v)) }.join(',') + ')'
|
77
85
|
when Hash then
|
78
86
|
raise Error, "empty hash conditions are not allowed for #{field_name}" if value.empty?
|
data/lib/momomoto/table.rb
CHANGED
@@ -360,7 +360,10 @@ module Momomoto
|
|
360
360
|
klass.schema_name = constraint.table_schema
|
361
361
|
namespace.const_set( constraint.table_name.capitalize, klass )
|
362
362
|
end
|
363
|
-
|
363
|
+
# double check we really got the right class as the class we got might be in another schema
|
364
|
+
if klass.table_name == constraint.table_name && klass.schema_name == constraint.table_schema
|
365
|
+
fk_helper_multiple( constraint.table_name, klass, primary_keys )
|
366
|
+
end
|
364
367
|
end
|
365
368
|
end
|
366
369
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: momomoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Klemm
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-01 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|