beezwax 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.
- data/VERSION +1 -1
- data/lib/btrieve/btrieve_table.rb +11 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -94,11 +94,21 @@ class BtrieveTable
|
|
94
94
|
raise Exception.new("No matching index for #{keys}")
|
95
95
|
end
|
96
96
|
|
97
|
+
INTEGER_TYPES=['TINYINT','SMALLINT','INTEGER','BIT','UTINYINT','USMALLINT','UINTEGER','UBIGINT']
|
98
|
+
FLOAT_TYPES=['REAL','DOUBLE']
|
97
99
|
def finder(match, index_number = nil, &block)
|
98
100
|
index_number ||= find_matching_index(match)
|
99
101
|
index = @schema[:indices][index_number]
|
100
102
|
columns = @schema[:columns]
|
101
|
-
key_components = index.inject([])
|
103
|
+
key_components = index.inject([]) do |vals, key|
|
104
|
+
datatype = BtrieveSchema.lookup(columns[key][:datatype], columns[key][:size])[:name]
|
105
|
+
puts "#{key}=>#{datatype}"
|
106
|
+
value = match[key]
|
107
|
+
value = value.to_f if FLOAT_TYPES.include?(datatype)
|
108
|
+
value = value.to_i if INTEGER_TYPES.include?(datatype)
|
109
|
+
vals << value
|
110
|
+
vals
|
111
|
+
end
|
102
112
|
key_packer = index.inject("") do |packer, key|
|
103
113
|
datatype = BtrieveSchema.lookup(columns[key][:datatype], columns[key][:size])
|
104
114
|
if(match[key] != nil)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beezwax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Lardin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-24 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|