omf_oml 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omf_oml/indexed_table.rb +5 -2
- data/lib/omf_oml/table.rb +8 -5
- data/lib/omf_oml/version.rb +1 -1
- metadata +2 -2
@@ -37,8 +37,11 @@ module OMF::OML
|
|
37
37
|
# index_col - Name of column to index
|
38
38
|
# schema - Table schema
|
39
39
|
#
|
40
|
-
def initialize(name, index_col, schema, &on_before_row_added)
|
41
|
-
|
40
|
+
def initialize(name, index_col, schema, opts = {}, &on_before_row_added)
|
41
|
+
# if opts[:supress_index].nil?
|
42
|
+
# opts[:supress_index] = true
|
43
|
+
# end
|
44
|
+
super name, schema, opts, &on_before_row_added
|
42
45
|
@index_col = index_col
|
43
46
|
@index2row = {} # each row is associated with an instance of the index
|
44
47
|
@index = @schema.index_for_col(index_col)
|
data/lib/omf_oml/table.rb
CHANGED
@@ -40,10 +40,11 @@ module OMF::OML
|
|
40
40
|
#
|
41
41
|
# tname - Name of table
|
42
42
|
# schema - OmlSchema or Array containing [name, type*] for every column in table
|
43
|
-
# Table adds a '__id__' column at the beginning which keeps track of the rows unique id
|
43
|
+
# Table adds a '__id__' column at the beginning which keeps track of the rows unique id unless
|
44
|
+
# option 'supress_index' is set.
|
44
45
|
# opts -
|
45
46
|
# :max_size - keep table to that size by dropping older rows
|
46
|
-
# :
|
47
|
+
# :supress_index - don't add index, even if schema doesn't start with '__id__'
|
47
48
|
#
|
48
49
|
def initialize(tname, schema, opts = {}, &on_before_row_added)
|
49
50
|
super tname
|
@@ -51,9 +52,11 @@ module OMF::OML
|
|
51
52
|
@name = tname
|
52
53
|
@schema = OmlSchema.create(schema)
|
53
54
|
@add_index = false
|
54
|
-
unless
|
55
|
-
@
|
56
|
-
|
55
|
+
unless opts[:supress_index]
|
56
|
+
unless @schema.name_at(0) == :__id__
|
57
|
+
@add_index = true
|
58
|
+
@schema.insert_column_at(0, [:__id__, 'int'])
|
59
|
+
end
|
57
60
|
end
|
58
61
|
@opts = opts
|
59
62
|
if (index = opts[:index])
|
data/lib/omf_oml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_oml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omf_base
|