update cmt set
,memo=#memo#
,memotype=case when cdepth=0 then #memotype# else memotype end
fgno=#fgno#
where #cmtno# <>0 and cmtno=#cmtno#;
insert into cmt (cmttype,pcmtno,cdepth,tcmtno,baseno,memotype,memo,fgno,isdel,)
select #cmttype#,#pcmtno#
,case when #pcmtno# is null then 0 else b.cdepth+1 end
,case when #pcmtno# is null then null else case when b.cdepth=0 then b.cmtno else b.tcmtno end end
,#baseno#,case when #pcmtno# is null then #memotype# else null end,#memo#,#fgno#,0,
from (select 1 col1) a
left outer join cmt b on b.cmtno=#pcmtno#
where #cmtno#=0;
update cmt set isdel=1 where cmtno=#cmtno# and (#isadmin# is not null or cno=#cno#);
insert into emailsend(etitle,semail,ehtml,fgno,cmno,rcvs,reademails,rcvcount,readcount,)
values (#etitle#,#semail#,#ehtml#,#fgno#,#cmno#,#rcvs#,#reademails#,#rcvcount#,#readcount#,)
SELECT LAST_INSERT_ID()
update emailsend set isdel=0,readcount=#readcount#,sendeds=#sendeds# where sendno=#sendno#
insert into emailban(sendno,email,)
values
(#sendno#,#Ds[].bans#,now(),#Ds[].uno#,now(),#Ds[].uno#,#Ds[].uip#)
update memouser set isdel=1, where userno=#uno#
update memo set isdel=1, where cno=#uno#
update memouser set isdel=1,
where userno=#uno#
and mno in ($mnos$)and mno=#mno#
update memo set isdel=1, where cno=#uno#
and mno in ($mnos$)and mno=#mno#
insert into memo (pmno,mtitle,mcontents,fgno,Isdel,)
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0,,#cno#,,#uno#,#uip#);
insert into memouser (mno,userno,isread,isdel,)
select LAST_INSERT_ID(),userno,1,0,0,
from users where userno in ($usernos$) and isdel=0
insert into memo (pmno,mtitle,mcontents,fgno,isdel,)
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0,,#cno#,,#uno#,#uip#);
insert into memouser (mno,userno,isread,isdel,)
select LAST_INSERT_ID(),userno,1,0,0,
from users
where usertype in ($usertype$) and isdel=0
insert into memo (pmno,cmno,mtitle,mcontents,fgno,isdel,)
values (#pmno#,#cmno#,#mtitle#,#mcontents#,#fgno#,0,);
insert into memouser (mno,userno,isread,isdel,)
select LAST_INSERT_ID(), a.userno,0,0,
from users a
where a.userno in ($usernos$)
insert into sms(cmno,mcontents,)
values (#cmno#,#mcontents#,);
SELECT LAST_INSERT_ID()
insert into smsuser (mno,userno,smstype,isok,msgid,message,)
values
(#mno#,#Users[].userno#,#Users[].smstype#,#Users[].isok#,#Users[].msgid#,#Users[].message#,now(),#uno#,now(),#uno#,#uip#)
update authkey set jobkey=#jobkey#,randkey=#randkey#,keytime=date_add(now(), interval 1 minute)
where authtype=#authtype# and userno=#userno#;
insert into authkey (authtype,userno,jobkey,randkey,keytime)
select a.authtype,a.userno,a.jobkey,a.randkey,date_add(now(), interval 1 minute)
from (select #authtype# authtype,#userno# userno,#jobkey# jobkey,#randkey# randkey) a
left outer join authkey b on b.authtype=a.authtype and b.userno=a.userno
where b.authtype is null
update ct set authkey=#intval30# where ctno=#intval#
update question set authkey=#intval30# where qno=#intval#
insert into smsauth(latime,lakey,lectno)
values(now(),#lakey#,#lectno#);
SELECT LAST_INSERT_ID()
insert into smsauth(latime,lakey,userno, lectno)
values(now(),#lakey#,#userno#, 0);
SELECT LAST_INSERT_ID()
update smsauth
set latime = now()
where authno = #authno#
insert into MTS_ATALK_MSG (TRAN_SENDER_KEY,TRAN_TMPL_CD,TRAN_CALLBACK,TRAN_PHONE,TRAN_SUBJECT,TRAN_MSG,TRAN_DATE,TRAN_TYPE,TRAN_STATUS,TRAN_REPLACE_TYPE,TRAN_REPLACE_MSG)
values (#senderkey#,#method#,#SEND_PHONE#,#DEST_PHONE#,#title#,#MSG_BODY#,now(),5,'1',#replace_type#,#MSG_BODY#);