????????????????????
???????????? ???????[ 2014/1/20 13:19:15 ] ??????????????? ????
?????????????У??????????????LUA?????????
local file_in = "d:\sync_tables.sql"
local file_out = "d:\sync_trigs.sql"
local tbl_prop = {}
local fp = io.open(file_in?? "r")
if fp then
while true do
s1 = fp:read("*l")
if not s1 then break end
_??_??s2 = string.find(s1?? ""([%w%_]+)"")
if s2 then
tbl_prop[s2] = 1
end
end
end
local sql_prep = [[
drop trigger if exists trig_$OP_$TAB;
delimiter |
create trigger trig_$OP_$TAB after $OP on $TAB
for each row
begin
update Tab_Version_Tab set TrigVersion=UNIX_TIMESTAMP() where Tab_Name = '$TAB';
end;
|
delimiter ;
]]
local tbl_rep = {"insert"?? "update"?? "delete"}
local fp_out = io.open(file_out?? "w")
if fp_out then
fp_out:write("use xopensdb
")
for k??v in pairs(tbl_prop) do
fp_out:write("-- triggers of " .. k .. "
")
for k1??v1 in pairs(tbl_rep) do
local sql_out = sql_prep
sql_out = string.gsub( sql_out?? "$TAB"?? k);
sql_out = string.gsub( sql_out?? "$OP"?? v1);
fp_out:write(sql_out)
fp_out:write("
")
end
fp_out:write("
")
end
end
???????? ??????????
????????????????Tab_Version_Tab???????????仯??????????仯????????????????????????????????????????У???????????????????????????
????1. ???????????????????
????2. ??natural join?????????????????????????
????SELECT COUNT(*) FROM table_local NATURAL JOIN table_tmp;
????????????????????????????????
????MySQL??DBLINK???????????????????Щ??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11