daff 1.2.6 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/bin/daff.rb +0 -0
- data/lib/daff.rb +6 -0
- data/lib/lib/coopy/alignment.rb +146 -169
- data/lib/lib/coopy/cell_builder.rb +1 -1
- data/lib/lib/coopy/cell_info.rb +2 -1
- data/lib/lib/coopy/column_change.rb +16 -0
- data/lib/lib/coopy/compare_flags.rb +33 -5
- data/lib/lib/coopy/compare_table.rb +219 -99
- data/lib/lib/coopy/coopy.rb +205 -99
- data/lib/lib/coopy/csv.rb +17 -22
- data/lib/lib/coopy/diff_render.rb +16 -8
- data/lib/lib/coopy/flat_cell_builder.rb +11 -8
- data/lib/lib/coopy/highlight_patch.rb +363 -63
- data/lib/lib/coopy/highlight_patch_unit.rb +1 -1
- data/lib/lib/coopy/index.rb +21 -8
- data/lib/lib/coopy/index_item.rb +7 -3
- data/lib/lib/coopy/index_pair.rb +13 -10
- data/lib/lib/coopy/merger.rb +3 -3
- data/lib/lib/coopy/meta.rb +17 -0
- data/lib/lib/coopy/mover.rb +7 -5
- data/lib/lib/coopy/ndjson.rb +2 -2
- data/lib/lib/coopy/nested_cell_builder.rb +7 -7
- data/lib/lib/coopy/ordering.rb +6 -2
- data/lib/lib/coopy/property_change.rb +16 -0
- data/lib/lib/coopy/row.rb +1 -0
- data/lib/lib/coopy/row_change.rb +42 -0
- data/lib/lib/coopy/row_stream.rb +11 -0
- data/lib/lib/coopy/simple_table.rb +84 -30
- data/lib/lib/coopy/simple_view.rb +8 -8
- data/lib/lib/coopy/sparse_sheet.rb +1 -1
- data/lib/lib/coopy/sql_column.rb +22 -10
- data/lib/lib/coopy/sql_compare.rb +397 -85
- data/lib/lib/coopy/sql_database.rb +2 -0
- data/lib/lib/coopy/sql_helper.rb +5 -0
- data/lib/lib/coopy/sql_table.rb +122 -19
- data/lib/lib/coopy/sql_table_name.rb +1 -1
- data/lib/lib/coopy/sqlite_helper.rb +250 -3
- data/lib/lib/coopy/table.rb +1 -0
- data/lib/lib/coopy/table_diff.rb +643 -464
- data/lib/lib/coopy/table_io.rb +19 -6
- data/lib/lib/coopy/table_modifier.rb +1 -1
- data/lib/lib/coopy/table_stream.rb +102 -0
- data/lib/lib/coopy/terminal_diff_render.rb +4 -3
- data/lib/lib/coopy/unit.rb +22 -2
- data/lib/lib/coopy/viterbi.rb +4 -4
- data/lib/lib/haxe/ds/int_map.rb +1 -1
- data/lib/lib/haxe/ds/string_map.rb +1 -1
- data/lib/lib/haxe/format/json_parser.rb +1 -1
- data/lib/lib/haxe/format/json_printer.rb +1 -1
- data/lib/lib/haxe/io/bytes.rb +2 -2
- data/lib/lib/haxe/io/eof.rb +1 -1
- data/lib/lib/haxe/io/output.rb +1 -1
- data/lib/lib/hx_overrides.rb +1 -1
- data/lib/lib/hx_sys.rb +9 -5
- data/lib/lib/lambda.rb +3 -3
- data/lib/lib/list.rb +1 -1
- data/lib/lib/rb/ruby_iterator.rb +2 -2
- data/lib/lib/reflect.rb +1 -1
- data/lib/lib/sys/io/file_output.rb +1 -1
- data/lib/lib/sys/io/hx_file.rb +1 -1
- data/lib/lib/x_list/list_iterator.rb +2 -2
- metadata +29 -25
- data/lib/lib/coopy/table_text.rb +0 -26
- data/lib/lib/haxe/io/bytes_buffer.rb +0 -19
- data/lib/lib/haxe/io/bytes_input.rb +0 -13
- data/lib/lib/haxe/io/bytes_output.rb +0 -33
- data/lib/lib/haxe/io/input.rb +0 -11
@@ -10,7 +10,7 @@ module Coopy
|
|
10
10
|
def update(local,remote) puts "Abstract CellBuilder.update called" end
|
11
11
|
def conflict(parent,local,remote) puts "Abstract CellBuilder.conflict called" end
|
12
12
|
def marker(label) puts "Abstract CellBuilder.marker called" end
|
13
|
-
def links(unit) puts "Abstract CellBuilder.links called" end
|
13
|
+
def links(unit,row_like) puts "Abstract CellBuilder.links called" end
|
14
14
|
haxe_me ["coopy", "CellBuilder"]
|
15
15
|
end
|
16
16
|
|
data/lib/lib/coopy/cell_info.rb
CHANGED
@@ -19,11 +19,12 @@ module Coopy
|
|
19
19
|
attr_accessor :pvalue
|
20
20
|
attr_accessor :lvalue
|
21
21
|
attr_accessor :rvalue
|
22
|
+
attr_accessor :meta
|
22
23
|
|
23
24
|
def to_s
|
24
25
|
return @value if !@updated
|
25
26
|
return _hx_str(@lvalue) + "::" + _hx_str(@rvalue) if !@conflicted
|
26
|
-
|
27
|
+
_hx_str(@pvalue) + "||" + _hx_str(@lvalue) + "::" + _hx_str(@rvalue)
|
27
28
|
end
|
28
29
|
|
29
30
|
haxe_me ["coopy", "CellInfo"]
|
@@ -17,6 +17,13 @@ module Coopy
|
|
17
17
|
@ids = nil
|
18
18
|
@columns_to_ignore = nil
|
19
19
|
@allow_nested_cells = false
|
20
|
+
@warnings = nil
|
21
|
+
@diff_strategy = nil
|
22
|
+
@show_meta = true
|
23
|
+
@show_unchanged_meta = false
|
24
|
+
@tables = nil
|
25
|
+
@parent = nil
|
26
|
+
@count_like_a_spreadsheet = true
|
20
27
|
end
|
21
28
|
|
22
29
|
attr_accessor :ordered
|
@@ -30,7 +37,14 @@ module Coopy
|
|
30
37
|
attr_accessor :acts
|
31
38
|
attr_accessor :ids
|
32
39
|
attr_accessor :columns_to_ignore
|
40
|
+
attr_accessor :tables
|
33
41
|
attr_accessor :allow_nested_cells
|
42
|
+
attr_accessor :warnings
|
43
|
+
attr_accessor :diff_strategy
|
44
|
+
attr_accessor :show_meta
|
45
|
+
attr_accessor :show_unchanged_meta
|
46
|
+
attr_accessor :parent
|
47
|
+
attr_accessor :count_like_a_spreadsheet
|
34
48
|
|
35
49
|
def filter(act,allow)
|
36
50
|
if @acts == nil
|
@@ -41,22 +55,22 @@ module Coopy
|
|
41
55
|
end
|
42
56
|
return false if !@acts.include?(act)
|
43
57
|
@acts[act] = allow
|
44
|
-
|
58
|
+
true
|
45
59
|
end
|
46
60
|
|
47
61
|
def allow_update
|
48
62
|
return true if @acts == nil
|
49
|
-
|
63
|
+
@acts.include?("update")
|
50
64
|
end
|
51
65
|
|
52
66
|
def allow_insert
|
53
67
|
return true if @acts == nil
|
54
|
-
|
68
|
+
@acts.include?("insert")
|
55
69
|
end
|
56
70
|
|
57
71
|
def allow_delete
|
58
72
|
return true if @acts == nil
|
59
|
-
|
73
|
+
@acts.include?("delete")
|
60
74
|
end
|
61
75
|
|
62
76
|
def get_ignored_columns
|
@@ -71,7 +85,7 @@ module Coopy
|
|
71
85
|
ignore[@columns_to_ignore[i]] = true
|
72
86
|
end
|
73
87
|
end
|
74
|
-
|
88
|
+
ignore
|
75
89
|
end
|
76
90
|
|
77
91
|
def add_primary_key(column)
|
@@ -84,6 +98,20 @@ module Coopy
|
|
84
98
|
@columns_to_ignore.push(column)
|
85
99
|
end
|
86
100
|
|
101
|
+
def add_table(table)
|
102
|
+
@tables = Array.new if @tables == nil
|
103
|
+
@tables.push(table)
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_warning(warn)
|
107
|
+
@warnings = Array.new if @warnings == nil
|
108
|
+
@warnings.push(warn)
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_warning
|
112
|
+
@warnings.join("\n")
|
113
|
+
end
|
114
|
+
|
87
115
|
haxe_me ["coopy", "CompareFlags"]
|
88
116
|
end
|
89
117
|
|
@@ -6,6 +6,9 @@ module Coopy
|
|
6
6
|
|
7
7
|
def initialize(comp)
|
8
8
|
@comp = comp
|
9
|
+
if comp.compare_flags != nil
|
10
|
+
comp.p = comp.compare_flags.parent if comp.compare_flags.parent != nil
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
protected
|
@@ -16,11 +19,15 @@ module Coopy
|
|
16
19
|
public
|
17
20
|
|
18
21
|
def run
|
22
|
+
if self.use_sql
|
23
|
+
@comp.completed = true
|
24
|
+
return false
|
25
|
+
end
|
19
26
|
more = self.compare_core
|
20
27
|
while(more && @comp.run_to_completion)
|
21
28
|
more = self.compare_core
|
22
29
|
end
|
23
|
-
|
30
|
+
!more
|
24
31
|
end
|
25
32
|
|
26
33
|
def align
|
@@ -29,16 +36,34 @@ module Coopy
|
|
29
36
|
end
|
30
37
|
alignment = ::Coopy::Alignment.new
|
31
38
|
self.align_core(alignment)
|
32
|
-
|
39
|
+
alignment
|
33
40
|
end
|
34
41
|
|
35
42
|
def get_comparison_state
|
36
|
-
|
43
|
+
@comp
|
37
44
|
end
|
38
45
|
|
39
46
|
protected
|
40
47
|
|
41
48
|
def align_core(align)
|
49
|
+
if self.use_sql
|
50
|
+
tab1 = nil
|
51
|
+
tab2 = nil
|
52
|
+
tab3 = nil
|
53
|
+
if @comp.p == nil
|
54
|
+
tab1 = @comp.a
|
55
|
+
tab2 = @comp.b
|
56
|
+
else
|
57
|
+
align.reference = ::Coopy::Alignment.new
|
58
|
+
tab1 = @comp.p
|
59
|
+
tab2 = @comp.b
|
60
|
+
tab3 = @comp.a
|
61
|
+
end
|
62
|
+
sc = ::Coopy::SqlCompare.new(tab1.get_database,tab1,tab2,tab3,align)
|
63
|
+
sc.apply
|
64
|
+
align.meta.reference = align.reference.meta if @comp.p != nil
|
65
|
+
return
|
66
|
+
end
|
42
67
|
if @comp.p == nil
|
43
68
|
self.align_core2(align,@comp.a,@comp.b)
|
44
69
|
return
|
@@ -90,8 +115,13 @@ module Coopy
|
|
90
115
|
end
|
91
116
|
end
|
92
117
|
end
|
118
|
+
index_top = nil
|
119
|
+
pending_ct = ha
|
120
|
+
reverse_pending_ct = hb
|
121
|
+
used = {}
|
122
|
+
used_reverse = {}
|
93
123
|
if ids != nil
|
94
|
-
|
124
|
+
index_top = ::Coopy::IndexPair.new
|
95
125
|
ids_as_map = {}
|
96
126
|
begin
|
97
127
|
_g2 = 0
|
@@ -112,23 +142,27 @@ module Coopy
|
|
112
142
|
na = av.to_s(a.get_cell(unit1.l,0))
|
113
143
|
nb = av.to_s(b.get_cell(unit1.r,0))
|
114
144
|
if ids_as_map.include?(na) || ids_as_map.include?(nb)
|
115
|
-
|
145
|
+
index_top.add_columns(unit1.l,unit1.r)
|
116
146
|
align.add_index_columns(unit1)
|
117
147
|
end
|
118
148
|
end
|
119
149
|
end
|
120
|
-
|
121
|
-
@indexes.push(
|
150
|
+
index_top.index_tables(a,b,1)
|
151
|
+
@indexes.push(index_top) if @indexes != nil
|
122
152
|
begin
|
123
153
|
_g4 = 0
|
124
154
|
while(_g4 < ha)
|
125
155
|
j = _g4
|
126
156
|
_g4+=1
|
127
|
-
cross =
|
157
|
+
cross = index_top.query_local(j)
|
128
158
|
spot_a = cross.spot_a
|
129
159
|
spot_b = cross.spot_b
|
130
160
|
next if spot_a != 1 || spot_b != 1
|
131
|
-
|
161
|
+
jb = cross.item_b.lst[0]
|
162
|
+
align.link(j,jb)
|
163
|
+
used[jb] = 1
|
164
|
+
reverse_pending_ct-=1 if !used_reverse.include?(j)
|
165
|
+
used_reverse[j] = 1
|
132
166
|
end
|
133
167
|
end
|
134
168
|
else
|
@@ -179,11 +213,11 @@ module Coopy
|
|
179
213
|
return -1 if a1[1] > b1[1]
|
180
214
|
return 1 if a1[0] > b1[0]
|
181
215
|
return -1 if a1[0] < b1[0]
|
182
|
-
|
216
|
+
0
|
183
217
|
}
|
184
|
-
columns_eval.sort{|a,b| sorter.call(a,b)}
|
218
|
+
columns_eval.sort!{|a,b| sorter.call(a,b)}
|
185
219
|
columns = Lambda.array(Lambda.map(columns_eval,lambda {|v|
|
186
|
-
|
220
|
+
v[0]
|
187
221
|
}))
|
188
222
|
columns = columns.slice(0,n - 1)
|
189
223
|
else
|
@@ -209,10 +243,8 @@ module Coopy
|
|
209
243
|
pending[j3] = j3
|
210
244
|
end
|
211
245
|
end
|
212
|
-
pending_ct = ha
|
213
246
|
added_columns = {}
|
214
247
|
index_ct = 0
|
215
|
-
index_top = nil
|
216
248
|
begin
|
217
249
|
_g8 = 0
|
218
250
|
while(_g8 < top)
|
@@ -228,7 +260,7 @@ module Coopy
|
|
228
260
|
kk >>= 1
|
229
261
|
at+=1
|
230
262
|
end
|
231
|
-
|
263
|
+
index = ::Coopy::IndexPair.new
|
232
264
|
begin
|
233
265
|
_g23 = 0
|
234
266
|
_g13 = active_columns.length
|
@@ -237,36 +269,42 @@ module Coopy
|
|
237
269
|
_g23+=1
|
238
270
|
col = active_columns[k1]
|
239
271
|
unit2 = common_units[col]
|
240
|
-
|
272
|
+
index.add_columns(unit2.l,unit2.r)
|
241
273
|
if !added_columns.include?(col)
|
242
274
|
align.add_index_columns(unit2)
|
243
275
|
added_columns[col] = true
|
244
276
|
end
|
245
277
|
end
|
246
278
|
end
|
247
|
-
|
248
|
-
index_top =
|
279
|
+
index.index_tables(a,b,1)
|
280
|
+
index_top = index if k == top - 1
|
249
281
|
h = a.get_height
|
250
282
|
h = b.get_height if b.get_height > h
|
251
283
|
h = 1 if h < 1
|
252
|
-
wide_top_freq =
|
284
|
+
wide_top_freq = index.get_top_freq
|
253
285
|
ratio = wide_top_freq
|
254
286
|
ratio /= h + 20
|
255
287
|
if ratio >= 0.1
|
256
288
|
next if index_ct > 0 || k < top - 1
|
257
289
|
end
|
258
290
|
index_ct+=1
|
259
|
-
@indexes.push(
|
291
|
+
@indexes.push(index) if @indexes != nil
|
260
292
|
fixed = Array.new
|
261
293
|
_it = ::Rb::RubyIterator.new(pending.keys)
|
262
294
|
while(_it.has_next) do
|
263
295
|
j4 = _it._next
|
264
|
-
cross1 =
|
296
|
+
cross1 = index.query_local(j4)
|
265
297
|
spot_a1 = cross1.spot_a
|
266
298
|
spot_b1 = cross1.spot_b
|
267
299
|
next if spot_a1 != 1 || spot_b1 != 1
|
268
|
-
|
269
|
-
|
300
|
+
val = cross1.item_b.lst[0]
|
301
|
+
if !used.include?(val)
|
302
|
+
fixed.push(j4)
|
303
|
+
align.link(j4,val)
|
304
|
+
used[val] = 1
|
305
|
+
reverse_pending_ct-=1 if !used_reverse.include?(j4)
|
306
|
+
used_reverse[j4] = 1
|
307
|
+
end
|
270
308
|
end
|
271
309
|
begin
|
272
310
|
_g24 = 0
|
@@ -280,47 +318,107 @@ module Coopy
|
|
280
318
|
end
|
281
319
|
end
|
282
320
|
end
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
next
|
305
|
-
end
|
306
|
-
next if xb == nil
|
307
|
-
ka = index_top.local_key(xa)
|
308
|
-
kb = index_top.remote_key(xb)
|
309
|
-
next if ka != kb
|
310
|
-
align.link(xa,xb)
|
311
|
-
pending_ct-=1
|
312
|
-
xb += scale
|
321
|
+
end
|
322
|
+
if index_top != nil
|
323
|
+
offset = 0
|
324
|
+
scale = 1
|
325
|
+
begin
|
326
|
+
_g9 = 0
|
327
|
+
while(_g9 < 2)
|
328
|
+
sgn = _g9
|
329
|
+
_g9+=1
|
330
|
+
if pending_ct > 0
|
331
|
+
xb = nil
|
332
|
+
xb = hb - 1 if scale == -1 && hb > 0
|
333
|
+
begin
|
334
|
+
_g15 = 0
|
335
|
+
while(_g15 < ha)
|
336
|
+
xa0 = _g15
|
337
|
+
_g15+=1
|
338
|
+
xa = xa0 * scale + offset
|
339
|
+
xb2 = align.a2b(xa)
|
340
|
+
if xb2 != nil
|
341
|
+
xb = xb2 + scale
|
313
342
|
break if xb >= hb || xb < 0
|
314
|
-
|
343
|
+
next
|
315
344
|
end
|
345
|
+
next if xb == nil
|
346
|
+
ka = index_top.local_key(xa)
|
347
|
+
kb = index_top.remote_key(xb)
|
348
|
+
next if ka != kb
|
349
|
+
next if used.include?(xb)
|
350
|
+
align.link(xa,xb)
|
351
|
+
used[xb] = 1
|
352
|
+
used_reverse[xa] = 1
|
353
|
+
pending_ct-=1
|
354
|
+
xb += scale
|
355
|
+
break if xb >= hb || xb < 0
|
356
|
+
break if pending_ct == 0
|
316
357
|
end
|
317
358
|
end
|
318
|
-
offset = ha - 1
|
319
|
-
scale = -1
|
320
359
|
end
|
360
|
+
offset = ha - 1
|
361
|
+
scale = -1
|
362
|
+
end
|
363
|
+
end
|
364
|
+
offset = 0
|
365
|
+
scale = 1
|
366
|
+
begin
|
367
|
+
_g10 = 0
|
368
|
+
while(_g10 < 2)
|
369
|
+
sgn1 = _g10
|
370
|
+
_g10+=1
|
371
|
+
if reverse_pending_ct > 0
|
372
|
+
xa1 = nil
|
373
|
+
xa1 = ha - 1 if scale == -1 && ha > 0
|
374
|
+
begin
|
375
|
+
_g16 = 0
|
376
|
+
while(_g16 < hb)
|
377
|
+
xb0 = _g16
|
378
|
+
_g16+=1
|
379
|
+
xb1 = xb0 * scale + offset
|
380
|
+
xa2 = align.b2a(xb1)
|
381
|
+
if xa2 != nil
|
382
|
+
xa1 = xa2 + scale
|
383
|
+
break if xa1 >= ha || xa1 < 0
|
384
|
+
next
|
385
|
+
end
|
386
|
+
next if xa1 == nil
|
387
|
+
ka1 = index_top.local_key(xa1)
|
388
|
+
kb1 = index_top.remote_key(xb1)
|
389
|
+
next if ka1 != kb1
|
390
|
+
next if used_reverse.include?(xa1)
|
391
|
+
align.link(xa1,xb1)
|
392
|
+
used[xb1] = 1
|
393
|
+
used_reverse[xa1] = 1
|
394
|
+
reverse_pending_ct-=1
|
395
|
+
xa1 += scale
|
396
|
+
break if xa1 >= ha || xa1 < 0
|
397
|
+
break if reverse_pending_ct == 0
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
offset = hb - 1
|
402
|
+
scale = -1
|
321
403
|
end
|
322
404
|
end
|
323
405
|
end
|
406
|
+
begin
|
407
|
+
_g17 = 1
|
408
|
+
while(_g17 < ha)
|
409
|
+
i2 = _g17
|
410
|
+
_g17+=1
|
411
|
+
align.link(i2,-1) if !used_reverse.include?(i2)
|
412
|
+
end
|
413
|
+
end
|
414
|
+
begin
|
415
|
+
_g18 = 1
|
416
|
+
while(_g18 < hb)
|
417
|
+
i3 = _g18
|
418
|
+
_g18+=1
|
419
|
+
align.link(-1,i3) if !used.include?(i3)
|
420
|
+
end
|
421
|
+
end
|
324
422
|
align.link(0,0) if ha > 0 && hb > 0
|
325
423
|
end
|
326
424
|
|
@@ -345,57 +443,59 @@ module Coopy
|
|
345
443
|
while(_g < slop)
|
346
444
|
ra = _g
|
347
445
|
_g+=1
|
348
|
-
break if ra >= a.get_height
|
349
446
|
begin
|
350
447
|
_g1 = 0
|
351
448
|
while(_g1 < slop)
|
352
449
|
rb1 = _g1
|
353
450
|
_g1+=1
|
354
|
-
break if rb1 >= b.get_height
|
355
451
|
ma = {}
|
356
452
|
mb = {}
|
357
453
|
ct = 0
|
358
454
|
uniques = 0
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
ma
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
455
|
+
if ra < a.get_height
|
456
|
+
begin
|
457
|
+
_g3 = 0
|
458
|
+
_g2 = a.get_width
|
459
|
+
while(_g3 < _g2)
|
460
|
+
ca = _g3
|
461
|
+
_g3+=1
|
462
|
+
key = va.to_s(a.get_cell(ca,ra))
|
463
|
+
if ma.include?(key)
|
464
|
+
ma[key] = -1
|
465
|
+
uniques-=1
|
466
|
+
else
|
467
|
+
ma[key] = ca
|
468
|
+
uniques+=1
|
469
|
+
end
|
372
470
|
end
|
373
471
|
end
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
472
|
+
if uniques > ra_uniques
|
473
|
+
ra_header = ra
|
474
|
+
ra_uniques = uniques
|
475
|
+
end
|
378
476
|
end
|
379
477
|
uniques = 0
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
mb
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
478
|
+
if rb1 < b.get_height
|
479
|
+
begin
|
480
|
+
_g31 = 0
|
481
|
+
_g21 = b.get_width
|
482
|
+
while(_g31 < _g21)
|
483
|
+
cb = _g31
|
484
|
+
_g31+=1
|
485
|
+
key1 = vb.to_s(b.get_cell(cb,rb1))
|
486
|
+
if mb.include?(key1)
|
487
|
+
mb[key1] = -1
|
488
|
+
uniques-=1
|
489
|
+
else
|
490
|
+
mb[key1] = cb
|
491
|
+
uniques+=1
|
492
|
+
end
|
393
493
|
end
|
394
494
|
end
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
495
|
+
if uniques > rb_uniques
|
496
|
+
rb_header = rb1
|
497
|
+
rb_uniques = uniques
|
498
|
+
end
|
399
499
|
end
|
400
500
|
_it = ::Rb::RubyIterator.new(ma.keys)
|
401
501
|
while(_it.has_next) do
|
@@ -430,7 +530,20 @@ module Coopy
|
|
430
530
|
key3 = _it2._next
|
431
531
|
i01 = ma_best[key3]
|
432
532
|
i11 = mb_best[key3]
|
433
|
-
|
533
|
+
if i01 != nil && i11 != nil
|
534
|
+
align.link(i01,i11)
|
535
|
+
elsif i01 != nil
|
536
|
+
align.link(i01,-1)
|
537
|
+
elsif i11 != nil
|
538
|
+
align.link(-1,i11)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
_it3 = ::Rb::RubyIterator.new(mb_best.keys)
|
542
|
+
while(_it3.has_next) do
|
543
|
+
key4 = _it3._next
|
544
|
+
i02 = ma_best[key4]
|
545
|
+
i12 = mb_best[key4]
|
546
|
+
align.link(-1,i12) if i02 == nil && i12 != nil
|
434
547
|
end
|
435
548
|
align.headers(ra_header,rb_header)
|
436
549
|
end
|
@@ -443,7 +556,7 @@ module Coopy
|
|
443
556
|
eq = self.has_same_columns2(p,a) if eq && p != nil
|
444
557
|
@comp.has_same_columns = eq
|
445
558
|
@comp.has_same_columns_known = true
|
446
|
-
|
559
|
+
true
|
447
560
|
end
|
448
561
|
|
449
562
|
def has_same_columns2(a,b)
|
@@ -468,7 +581,7 @@ module Coopy
|
|
468
581
|
return false if !av.equals(a.get_cell(i,0),b.get_cell(i,0))
|
469
582
|
end
|
470
583
|
end
|
471
|
-
|
584
|
+
true
|
472
585
|
end
|
473
586
|
|
474
587
|
def test_is_equal
|
@@ -479,7 +592,7 @@ module Coopy
|
|
479
592
|
eq = self.is_equal2(p,a) if eq && p != nil
|
480
593
|
@comp.is_equal = eq
|
481
594
|
@comp.is_equal_known = true
|
482
|
-
|
595
|
+
true
|
483
596
|
end
|
484
597
|
|
485
598
|
def is_equal2(a,b)
|
@@ -502,7 +615,7 @@ module Coopy
|
|
502
615
|
end
|
503
616
|
end
|
504
617
|
end
|
505
|
-
|
618
|
+
true
|
506
619
|
end
|
507
620
|
|
508
621
|
def compare_core
|
@@ -510,7 +623,7 @@ module Coopy
|
|
510
623
|
return self.test_is_equal if !@comp.is_equal_known
|
511
624
|
return self.test_has_same_columns if !@comp.has_same_columns_known
|
512
625
|
@comp.completed = true
|
513
|
-
|
626
|
+
false
|
514
627
|
end
|
515
628
|
|
516
629
|
public
|
@@ -520,7 +633,14 @@ module Coopy
|
|
520
633
|
end
|
521
634
|
|
522
635
|
def get_indexes
|
523
|
-
|
636
|
+
@indexes
|
637
|
+
end
|
638
|
+
|
639
|
+
protected
|
640
|
+
|
641
|
+
def use_sql
|
642
|
+
return false if @comp.compare_flags == nil
|
643
|
+
@comp.compare_flags.diff_strategy == "sql"
|
524
644
|
end
|
525
645
|
|
526
646
|
haxe_me ["coopy", "CompareTable"]
|