daff 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -1
- data/lib/daff.rb +20 -7
- data/lib/lib/coopy/alignment.rb +6 -0
- data/lib/lib/coopy/cell_info.rb +1 -0
- data/lib/lib/coopy/compare_flags.rb +2 -0
- data/lib/lib/coopy/compare_table.rb +1 -1
- data/lib/lib/coopy/coopy.rb +80 -18
- data/lib/lib/coopy/csv.rb +1 -1
- data/lib/lib/coopy/diff_render.rb +61 -22
- data/lib/lib/coopy/flat_cell_builder.rb +1 -1
- data/lib/lib/coopy/highlight_patch.rb +8 -6
- data/lib/lib/coopy/mover.rb +1 -1
- data/lib/lib/coopy/ndjson.rb +134 -0
- data/lib/lib/coopy/nested_cell_builder.rb +74 -0
- data/lib/lib/coopy/simple_view.rb +29 -0
- data/lib/lib/coopy/sql_column.rb +35 -0
- data/lib/lib/coopy/sql_compare.rb +245 -0
- data/lib/lib/coopy/sql_database.rb +19 -0
- data/lib/lib/coopy/sql_helper.rb +12 -0
- data/lib/lib/coopy/sql_table.rb +216 -0
- data/lib/lib/coopy/sql_table_name.rb +23 -0
- data/lib/lib/coopy/sqlite_helper.rb +47 -0
- data/lib/lib/coopy/table_diff.rb +18 -6
- data/lib/lib/coopy/table_io.rb +5 -0
- data/lib/lib/coopy/terminal_diff_render.rb +8 -9
- data/lib/lib/coopy/view.rb +5 -0
- data/lib/lib/haxe/ds/int_map.rb +4 -0
- data/lib/lib/haxe/ds/string_map.rb +4 -0
- data/lib/lib/haxe/format/json_parser.rb +8 -8
- data/lib/lib/haxe/imap.rb +1 -0
- data/lib/lib/haxe/io/bytes.rb +1 -1
- data/lib/lib/haxe/io/bytes_output.rb +1 -1
- data/lib/lib/haxe/io/error.rb +1 -0
- data/lib/lib/haxe/io/output.rb +2 -2
- data/lib/lib/hx_overrides.rb +12 -0
- data/lib/lib/hx_sys.rb +1 -1
- data/lib/lib/rb/boot.rb +5 -1
- data/lib/lib/reflect.rb +1 -0
- data/lib/lib/sys/io/file_handle.rb +1 -0
- data/lib/lib/sys/io/file_output.rb +1 -1
- data/lib/lib/value_type.rb +1 -0
- metadata +36 -25
@@ -8,6 +8,7 @@ module Coopy
|
|
8
8
|
@source = source
|
9
9
|
@patch = patch
|
10
10
|
@view = patch.get_cell_view
|
11
|
+
@source_view = source.get_cell_view
|
11
12
|
end
|
12
13
|
|
13
14
|
protected
|
@@ -15,6 +16,7 @@ module Coopy
|
|
15
16
|
attr_accessor :source
|
16
17
|
attr_accessor :patch
|
17
18
|
attr_accessor :view
|
19
|
+
attr_accessor :source_view
|
18
20
|
attr_accessor :csv
|
19
21
|
attr_accessor :header
|
20
22
|
attr_accessor :header_pre
|
@@ -201,13 +203,13 @@ module Coopy
|
|
201
203
|
if mod != nil
|
202
204
|
if (mod[0].ord rescue nil) == 58
|
203
205
|
move = true
|
204
|
-
mod = mod
|
206
|
+
mod = HxOverrides.substr(mod,1,mod.length)
|
205
207
|
end
|
206
208
|
end
|
207
209
|
@header[i] = name
|
208
210
|
if mod != nil
|
209
211
|
if (mod[0].ord rescue nil) == 40
|
210
|
-
prev_name = mod
|
212
|
+
prev_name = HxOverrides.substr(mod,1,mod.length - 2)
|
211
213
|
@header_pre[prev_name] = i
|
212
214
|
@header_post[name] = i
|
213
215
|
@header_rename[prev_name] = name
|
@@ -276,13 +278,13 @@ module Coopy
|
|
276
278
|
|
277
279
|
def check_act
|
278
280
|
act = self.get_string(@rc_offset)
|
279
|
-
::Coopy::DiffRender.examine_cell(0,0,act,"",act,"",@row_info) if @row_info.value != act
|
281
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,act,"",act,"",@row_info) if @row_info.value != act
|
280
282
|
end
|
281
283
|
|
282
284
|
def get_pre_string(txt)
|
283
285
|
self.check_act
|
284
286
|
return txt if !@row_info.updated
|
285
|
-
::Coopy::DiffRender.examine_cell(0,0,txt,"",@row_info.value,"",@cell_info)
|
287
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,txt,"",@row_info.value,"",@cell_info)
|
286
288
|
return txt if !@cell_info.updated
|
287
289
|
return @cell_info.lvalue
|
288
290
|
end
|
@@ -310,7 +312,7 @@ module Coopy
|
|
310
312
|
end
|
311
313
|
|
312
314
|
def process_mods(rmods,fate,len)
|
313
|
-
rmods.sort{|a,b| self.sort_mods(a,b)}
|
315
|
+
rmods.sort!{|a,b| self.sort_mods(a,b)}
|
314
316
|
offset = 0
|
315
317
|
last = -1
|
316
318
|
target = 0
|
@@ -512,7 +514,7 @@ module Coopy
|
|
512
514
|
while(_it2.has_next) do
|
513
515
|
c1 = _it2._next
|
514
516
|
txt = @view.to_s(@patch.get_cell(c1,mod1.patch_row))
|
515
|
-
::Coopy::DiffRender.examine_cell(0,0,txt,"",@row_info.value,"",@cell_info)
|
517
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,txt,"",@row_info.value,"",@cell_info)
|
516
518
|
next if !@cell_info.updated
|
517
519
|
next if @cell_info.conflicted
|
518
520
|
d = @view.to_datum(@csv.parse_cell(@cell_info.rvalue))
|
data/lib/lib/coopy/mover.rb
CHANGED
@@ -0,0 +1,134 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Ndjson
|
6
|
+
|
7
|
+
def initialize(tab)
|
8
|
+
@tab = tab
|
9
|
+
@view = tab.get_cell_view
|
10
|
+
@header_row = 0
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
attr_accessor :tab
|
16
|
+
attr_accessor :view
|
17
|
+
attr_accessor :columns
|
18
|
+
attr_accessor :header_row
|
19
|
+
|
20
|
+
public
|
21
|
+
|
22
|
+
def render_row(r)
|
23
|
+
row = {}
|
24
|
+
begin
|
25
|
+
_g1 = 0
|
26
|
+
_g = @tab.get_width
|
27
|
+
while(_g1 < _g)
|
28
|
+
c = _g1
|
29
|
+
_g1+=1
|
30
|
+
key = @view.to_s(@tab.get_cell(c,@header_row))
|
31
|
+
key = "@:@" if c == 0 && @header_row == 1
|
32
|
+
begin
|
33
|
+
value = @tab.get_cell(c,r)
|
34
|
+
begin
|
35
|
+
value1 = value
|
36
|
+
row[key] = value1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
return ::Haxe::Format::JsonPrinter._print(row,nil,nil)
|
42
|
+
end
|
43
|
+
|
44
|
+
def render
|
45
|
+
txt = ""
|
46
|
+
offset = 0
|
47
|
+
return txt if @tab.get_height == 0
|
48
|
+
return txt if @tab.get_width == 0
|
49
|
+
offset = 1 if @tab.get_cell(0,0) == "@:@"
|
50
|
+
@header_row = offset
|
51
|
+
begin
|
52
|
+
_g1 = @header_row + 1
|
53
|
+
_g = @tab.get_height
|
54
|
+
while(_g1 < _g)
|
55
|
+
r = _g1
|
56
|
+
_g1+=1
|
57
|
+
txt += self.render_row(r)
|
58
|
+
txt += "\n"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
return txt
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_row(r,txt)
|
65
|
+
json = ::Haxe::Format::JsonParser.new(txt).parse_rec
|
66
|
+
@columns = {} if @columns == nil
|
67
|
+
w = @tab.get_width
|
68
|
+
h = @tab.get_height
|
69
|
+
resize = false
|
70
|
+
begin
|
71
|
+
_g = 0
|
72
|
+
_g1 = Reflect.fields(json)
|
73
|
+
while(_g < _g1.length)
|
74
|
+
name = _g1[_g]
|
75
|
+
_g+=1
|
76
|
+
if !@columns.include?(name)
|
77
|
+
@columns[name] = w
|
78
|
+
w+=1
|
79
|
+
resize = true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
if r >= h
|
84
|
+
h = r + 1
|
85
|
+
resize = true
|
86
|
+
end
|
87
|
+
@tab.resize(w,h) if resize
|
88
|
+
begin
|
89
|
+
_g2 = 0
|
90
|
+
_g11 = Reflect.fields(json)
|
91
|
+
while(_g2 < _g11.length)
|
92
|
+
name1 = _g11[_g2]
|
93
|
+
_g2+=1
|
94
|
+
v = Reflect.field(json,name1)
|
95
|
+
c = @columns[name1]
|
96
|
+
@tab.set_cell(c,r,v)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def add_header_row(r)
|
102
|
+
names = ::Rb::RubyIterator.new(@columns.keys)
|
103
|
+
_it = names
|
104
|
+
while(_it.has_next) do
|
105
|
+
n = _it._next
|
106
|
+
@tab.set_cell(@columns[n],r,@view.to_datum(n))
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def parse(txt)
|
111
|
+
@columns = nil
|
112
|
+
rows = txt.split("\n")
|
113
|
+
h = rows.length
|
114
|
+
if h == 0
|
115
|
+
@tab.clear
|
116
|
+
return
|
117
|
+
end
|
118
|
+
h-=1 if rows[h - 1] == ""
|
119
|
+
begin
|
120
|
+
_g = 0
|
121
|
+
while(_g < h)
|
122
|
+
i = _g
|
123
|
+
_g+=1
|
124
|
+
at = h - i - 1
|
125
|
+
self.add_row(at + 1,rows[at])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
self.add_header_row(0)
|
129
|
+
end
|
130
|
+
|
131
|
+
haxe_me
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class NestedCellBuilder
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
attr_accessor :view
|
13
|
+
|
14
|
+
public
|
15
|
+
|
16
|
+
def need_separator
|
17
|
+
return false
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_separator(separator)
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_conflict_separator(separator)
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_view(view)
|
27
|
+
@view = view
|
28
|
+
end
|
29
|
+
|
30
|
+
def update(local,remote)
|
31
|
+
h = @view.make_hash
|
32
|
+
@view.hash_set(h,"before",local)
|
33
|
+
@view.hash_set(h,"after",remote)
|
34
|
+
return h
|
35
|
+
end
|
36
|
+
|
37
|
+
def conflict(parent,local,remote)
|
38
|
+
h = @view.make_hash
|
39
|
+
@view.hash_set(h,"before",parent)
|
40
|
+
@view.hash_set(h,"ours",local)
|
41
|
+
@view.hash_set(h,"theirs",remote)
|
42
|
+
return h
|
43
|
+
end
|
44
|
+
|
45
|
+
def marker(label)
|
46
|
+
return @view.to_datum(label)
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def neg_to_null(x)
|
52
|
+
return nil if x < 0
|
53
|
+
return x
|
54
|
+
end
|
55
|
+
|
56
|
+
public
|
57
|
+
|
58
|
+
def links(unit)
|
59
|
+
h = @view.make_hash
|
60
|
+
if unit.p >= -1
|
61
|
+
@view.hash_set(h,"before",self.neg_to_null(unit.p))
|
62
|
+
@view.hash_set(h,"ours",self.neg_to_null(unit.l))
|
63
|
+
@view.hash_set(h,"theirs",self.neg_to_null(unit.r))
|
64
|
+
return h
|
65
|
+
end
|
66
|
+
@view.hash_set(h,"before",self.neg_to_null(unit.l))
|
67
|
+
@view.hash_set(h,"after",self.neg_to_null(unit.r))
|
68
|
+
return h
|
69
|
+
end
|
70
|
+
|
71
|
+
haxe_me
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -23,6 +23,35 @@ module Coopy
|
|
23
23
|
return x
|
24
24
|
end
|
25
25
|
|
26
|
+
def make_hash
|
27
|
+
return {}
|
28
|
+
end
|
29
|
+
|
30
|
+
def hash_set(h,str,d)
|
31
|
+
hh = h
|
32
|
+
begin
|
33
|
+
value = d
|
34
|
+
begin
|
35
|
+
value1 = value
|
36
|
+
hh[str] = value1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def hash_exists(h,str)
|
42
|
+
hh = h
|
43
|
+
return hh.include?(str)
|
44
|
+
end
|
45
|
+
|
46
|
+
def hash_get(h,str)
|
47
|
+
hh = h
|
48
|
+
return hh[str]
|
49
|
+
end
|
50
|
+
|
51
|
+
def is_hash(h)
|
52
|
+
return h.respond_to? :keys
|
53
|
+
end
|
54
|
+
|
26
55
|
haxe_me
|
27
56
|
end
|
28
57
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class SqlColumn
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :name
|
11
|
+
attr_accessor :primary
|
12
|
+
|
13
|
+
def get_name
|
14
|
+
return @name
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_primary_key
|
18
|
+
return @primary
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
return _hx_str((((@primary) ? "*" : ""))) + _hx_str(@name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def SqlColumn.by_name_and_primary_key(name,primary)
|
26
|
+
result = ::Coopy::SqlColumn.new
|
27
|
+
result.name = name
|
28
|
+
result.primary = primary
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
haxe_me
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class SqlCompare
|
6
|
+
|
7
|
+
def initialize(db,local,remote)
|
8
|
+
@db = db
|
9
|
+
@local = local
|
10
|
+
@remote = remote
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :db
|
14
|
+
attr_accessor :parent
|
15
|
+
attr_accessor :local
|
16
|
+
attr_accessor :remote
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
attr_accessor :at0
|
21
|
+
attr_accessor :at1
|
22
|
+
attr_accessor :align
|
23
|
+
|
24
|
+
def equal_array(a1,a2)
|
25
|
+
return false if a1.length != a2.length
|
26
|
+
begin
|
27
|
+
_g1 = 0
|
28
|
+
_g = a1.length
|
29
|
+
while(_g1 < _g)
|
30
|
+
i = _g1
|
31
|
+
_g1+=1
|
32
|
+
return false if a1[i] != a2[i]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
|
38
|
+
public
|
39
|
+
|
40
|
+
def validate_schema
|
41
|
+
all_cols1 = @local.get_column_names
|
42
|
+
all_cols2 = @remote.get_column_names
|
43
|
+
return false if !self.equal_array(all_cols1,all_cols2)
|
44
|
+
key_cols1 = @local.get_primary_key
|
45
|
+
key_cols2 = @remote.get_primary_key
|
46
|
+
return false if !self.equal_array(key_cols1,key_cols2)
|
47
|
+
return false if key_cols1.length == 0
|
48
|
+
return true
|
49
|
+
end
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
def denull(x)
|
54
|
+
return -1 if x == nil
|
55
|
+
return x
|
56
|
+
end
|
57
|
+
|
58
|
+
def link
|
59
|
+
i0 = self.denull(@db.get(0))
|
60
|
+
i1 = self.denull(@db.get(1))
|
61
|
+
if i0 == -3
|
62
|
+
i0 = @at0
|
63
|
+
@at0+=1
|
64
|
+
end
|
65
|
+
if i1 == -3
|
66
|
+
i1 = @at1
|
67
|
+
@at1+=1
|
68
|
+
end
|
69
|
+
factor = nil
|
70
|
+
if i0 >= 0 && i1 >= 0
|
71
|
+
factor = 2
|
72
|
+
else
|
73
|
+
factor = 1
|
74
|
+
end
|
75
|
+
offset = factor - 1
|
76
|
+
if i0 >= 0
|
77
|
+
_g1 = 0
|
78
|
+
_g = @local.get_width
|
79
|
+
while(_g1 < _g)
|
80
|
+
x = _g1
|
81
|
+
_g1+=1
|
82
|
+
@local.set_cell_cache(x,i0,@db.get(2 + factor * x))
|
83
|
+
end
|
84
|
+
end
|
85
|
+
if i1 >= 0
|
86
|
+
_g11 = 0
|
87
|
+
_g2 = @remote.get_width
|
88
|
+
while(_g11 < _g2)
|
89
|
+
x1 = _g11
|
90
|
+
_g11+=1
|
91
|
+
@remote.set_cell_cache(x1,i1,@db.get(2 + factor * x1 + offset))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
@align.link(i0,i1)
|
95
|
+
@align.add_to_order(i0,i1)
|
96
|
+
end
|
97
|
+
|
98
|
+
def link_query(query,order)
|
99
|
+
if @db._begin(query,nil,order)
|
100
|
+
while(@db.read)
|
101
|
+
self.link
|
102
|
+
end
|
103
|
+
@db._end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
public
|
108
|
+
|
109
|
+
def apply
|
110
|
+
return nil if @db == nil
|
111
|
+
return nil if !self.validate_schema
|
112
|
+
rowid_name = @db.rowid
|
113
|
+
@align = ::Coopy::Alignment.new
|
114
|
+
key_cols = @local.get_primary_key
|
115
|
+
data_cols = @local.get_all_but_primary_key
|
116
|
+
all_cols = @local.get_column_names
|
117
|
+
@align.meta = ::Coopy::Alignment.new
|
118
|
+
begin
|
119
|
+
_g1 = 0
|
120
|
+
_g = all_cols.length
|
121
|
+
while(_g1 < _g)
|
122
|
+
i = _g1
|
123
|
+
_g1+=1
|
124
|
+
@align.meta.link(i,i)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
@align.meta.range(all_cols.length,all_cols.length)
|
128
|
+
@align.tables(@local,@remote)
|
129
|
+
@align.range(999,999)
|
130
|
+
sql_table1 = @local.get_quoted_table_name
|
131
|
+
sql_table2 = @remote.get_quoted_table_name
|
132
|
+
sql_key_cols = ""
|
133
|
+
begin
|
134
|
+
_g11 = 0
|
135
|
+
_g2 = key_cols.length
|
136
|
+
while(_g11 < _g2)
|
137
|
+
i1 = _g11
|
138
|
+
_g11+=1
|
139
|
+
sql_key_cols += "," if i1 > 0
|
140
|
+
sql_key_cols += @local.get_quoted_column_name(key_cols[i1])
|
141
|
+
end
|
142
|
+
end
|
143
|
+
sql_all_cols = ""
|
144
|
+
begin
|
145
|
+
_g12 = 0
|
146
|
+
_g3 = all_cols.length
|
147
|
+
while(_g12 < _g3)
|
148
|
+
i2 = _g12
|
149
|
+
_g12+=1
|
150
|
+
sql_all_cols += "," if i2 > 0
|
151
|
+
sql_all_cols += @local.get_quoted_column_name(all_cols[i2])
|
152
|
+
end
|
153
|
+
end
|
154
|
+
sql_key_match = ""
|
155
|
+
begin
|
156
|
+
_g13 = 0
|
157
|
+
_g4 = key_cols.length
|
158
|
+
while(_g13 < _g4)
|
159
|
+
i3 = _g13
|
160
|
+
_g13+=1
|
161
|
+
sql_key_match += " AND " if i3 > 0
|
162
|
+
n = @local.get_quoted_column_name(key_cols[i3])
|
163
|
+
sql_key_match += _hx_str(sql_table1) + "." + _hx_str(n) + " IS " + _hx_str(sql_table2) + "." + _hx_str(n)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
sql_data_mismatch = ""
|
167
|
+
begin
|
168
|
+
_g14 = 0
|
169
|
+
_g5 = data_cols.length
|
170
|
+
while(_g14 < _g5)
|
171
|
+
i4 = _g14
|
172
|
+
_g14+=1
|
173
|
+
sql_data_mismatch += " OR " if i4 > 0
|
174
|
+
n1 = @local.get_quoted_column_name(data_cols[i4])
|
175
|
+
sql_data_mismatch += _hx_str(sql_table1) + "." + _hx_str(n1) + " IS NOT " + _hx_str(sql_table2) + "." + _hx_str(n1)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
sql_dbl_cols = ""
|
179
|
+
dbl_cols = []
|
180
|
+
begin
|
181
|
+
_g15 = 0
|
182
|
+
_g6 = all_cols.length
|
183
|
+
while(_g15 < _g6)
|
184
|
+
i5 = _g15
|
185
|
+
_g15+=1
|
186
|
+
sql_dbl_cols += "," if i5 > 0
|
187
|
+
n2 = @local.get_quoted_column_name(all_cols[i5])
|
188
|
+
buf = "__coopy_" + _hx_str(i5)
|
189
|
+
sql_dbl_cols += _hx_str(sql_table1) + "." + _hx_str(n2) + " AS " + _hx_str(buf)
|
190
|
+
dbl_cols.push(buf)
|
191
|
+
sql_dbl_cols += ","
|
192
|
+
sql_dbl_cols += _hx_str(sql_table2) + "." + _hx_str(n2) + " AS " + _hx_str(buf) + "b"
|
193
|
+
dbl_cols.push(_hx_str(buf) + "b")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
sql_order = ""
|
197
|
+
begin
|
198
|
+
_g16 = 0
|
199
|
+
_g7 = key_cols.length
|
200
|
+
while(_g16 < _g7)
|
201
|
+
i6 = _g16
|
202
|
+
_g16+=1
|
203
|
+
sql_order += "," if i6 > 0
|
204
|
+
n3 = @local.get_quoted_column_name(key_cols[i6])
|
205
|
+
sql_order += n3
|
206
|
+
end
|
207
|
+
end
|
208
|
+
sql_dbl_order = ""
|
209
|
+
begin
|
210
|
+
_g17 = 0
|
211
|
+
_g8 = key_cols.length
|
212
|
+
while(_g17 < _g8)
|
213
|
+
i7 = _g17
|
214
|
+
_g17+=1
|
215
|
+
sql_dbl_order += "," if i7 > 0
|
216
|
+
n4 = @local.get_quoted_column_name(key_cols[i7])
|
217
|
+
sql_dbl_order += _hx_str(sql_table1) + "." + _hx_str(n4)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
rowid = "-3"
|
221
|
+
rowid1 = "-3"
|
222
|
+
rowid2 = "-3"
|
223
|
+
if rowid_name != nil
|
224
|
+
rowid = rowid_name
|
225
|
+
rowid1 = _hx_str(sql_table1) + "." + _hx_str(rowid_name)
|
226
|
+
rowid2 = _hx_str(sql_table2) + "." + _hx_str(rowid_name)
|
227
|
+
end
|
228
|
+
sql_inserts = "SELECT DISTINCT NULL, " + _hx_str(rowid) + " AS rowid, " + _hx_str(sql_all_cols) + " FROM " + _hx_str(sql_table2) + " WHERE NOT EXISTS (SELECT 1 FROM " + _hx_str(sql_table1) + " WHERE " + _hx_str(sql_key_match) + ")"
|
229
|
+
sql_inserts_order = ["NULL","rowid"].concat(all_cols)
|
230
|
+
sql_updates = "SELECT DISTINCT " + _hx_str(rowid1) + " AS __coopy_rowid0, " + _hx_str(rowid2) + " AS __coopy_rowid1, " + _hx_str(sql_dbl_cols) + " FROM " + _hx_str(sql_table1) + " INNER JOIN " + _hx_str(sql_table2) + " ON " + _hx_str(sql_key_match) + " WHERE " + _hx_str(sql_data_mismatch)
|
231
|
+
sql_updates_order = ["__coopy_rowid0","__coopy_rowid1"].concat(dbl_cols)
|
232
|
+
sql_deletes = "SELECT DISTINCT " + _hx_str(rowid) + " AS rowid, NULL, " + _hx_str(sql_all_cols) + " FROM " + _hx_str(sql_table1) + " WHERE NOT EXISTS (SELECT 1 FROM " + _hx_str(sql_table2) + " WHERE " + _hx_str(sql_key_match) + ")"
|
233
|
+
sql_deletes_order = ["rowid","NULL"].concat(all_cols)
|
234
|
+
@at0 = 1
|
235
|
+
@at1 = 1
|
236
|
+
self.link_query(sql_inserts,sql_inserts_order)
|
237
|
+
self.link_query(sql_updates,sql_updates_order)
|
238
|
+
self.link_query(sql_deletes,sql_deletes_order)
|
239
|
+
return @align
|
240
|
+
end
|
241
|
+
|
242
|
+
haxe_me
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|