Q&A

  • Lost connection to MySQL server during query
안녕하십니까..다른건 아니구..제목그대로 쿼링하는도중에 자꾸 연결이 끊기면서 프로그램이 죽어버려서여 다른 에러 핸들링이나 예외처리를 해줄 능력은 안되구...해서 또 글을 올립니다..고수님들의 조언을 부탁드립니다..



1. 에러메세지.



EDatabaseError with message 'Lost connection to MySQL server during query'.

단순하져...^^



2. 에러가 나는 곳이라구 예상되는 코딩구문..



with dm.T_displayQuery do

begin

if Active then

try

refresh;

except

main_form.Grid1bar.Panels[2].text := 'Fail to refresh display Table';

end;

main_form.Grid1bar.Panels[1].text := 'Count : '+inttostr(RecordCount);

main_form.Grid1bar.Panels[0].text := 'Display Table';

end;





>>> except 요기서 뭐가 해줘야 할 것 같기두..

참고루 위의 구문은 쓰레드이며 Timer에 의해 1초나 2초마다 다른 조건에 구애받지 않을때 실행됩니다.. 구래서..밑에다가 아예 쓰레드 함수 자체를 올려드릴께여..좀 길면 읽기 싫어하실 수 두 있을텐데..



3. 쿼리에 들어가있는 SQL구문..



select a.cus_no,b.cus_name, a.dtime,a.pre_ev, a.now_ev,a.em_check,a.c_time

from display as a

left outer join custom as b on a.cus_no = b.cus_no

order by Dtime desc





>> 아래에 쓰레드 부분을 올려드리기루 하구 여기서 인사들 드리져..즐거운 하루되시구 가내 두루 평안하시길.....^^



*************안읽으셔두 되는 코딩부분....관심있으심 읽어보셔두..^^



function refreshT_displayQuery(P:Pointer) : LongInt; StdCall

var

str_cusno,str_cusname,str_nowev : string;

Begin

In_Dquery := True;

if (not In_Uquery) and (not In_Rquery)then

begin

with dm.T_displayQuery do

begin

if Active then

try

refresh;

except

main_form.Grid1bar.Panels[2].text := 'Fail to refresh display Table';

{ try

begin

sleep(1000);

refresh;

end;

finally

begin

showmessage('통신상의 에러로 업데이트 작업을 중단합니다'+#13

+' 서버와의 연결을 점검하시고 재접속하십시요');

dm.T_displayQuery.Close;

dm.dbMain.disconnect;

end;

end; }

end;

main_form.Grid1bar.Panels[1].text := 'Count : '+inttostr(RecordCount);

main_form.Grid1bar.Panels[0].text := 'Display Table';

end;



with dm.Em_checkquery do

begin

if active then

begin

refresh;

{ // refresh

sql.add('select a.cus_no,b.cus_name,a.dtime,a.pre_ev,a.now_ev,a.em_check,a.c_time');

sql.add('from display as a');

sql.add('left outer join custom as b on a.cus_no = b.cus_no');

sql.Add('where em_check = ''1'' and c_time = ''0''');

sql.add('order by dtime desc');

}

if FieldByName('cus_no').asstring <> '' then

begin

str_cusno := FieldByName('cus_no').asstring;

str_cusname := FieldByName('cus_name').asstring;

str_nowev := FieldByName('now_ev').asstring;

Access_warn(str_cusno,str_cusname,str_nowev);

refresh_warn;

end;

end;

end;

end;

In_Dquery := False;

end;









0  COMMENTS