database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 30939 게시물 읽기
No. 30939
mysql자료를 한번봐주셔요 이게 루프에서 첫번째는 억는데 다음 루프때는 먹지 않음 이미 데이타는 있으므로 무조건 True가 나와야 하는데 false로 인식됩니다. 부탁드립니다.
작성자
임기섭(save2080)
작성일
2016-03-21 23:11
조회수
7,958

//제일 처음에 사용했던 로직

 if (SDBPool.TempQuery.Locate('Winnerid;', varArrayof([gameResult.Winnerid] ), [loCaseInsensitive]) = False) and

               (SDBPool.TempQuery.Locate('Loserid;', varArrayof([gameResult.Loserid]), [loCaseInsensitive]) = False) then begin

 

이게 루프에서 첫번째는 억는데 다음 루프때는 먹지 않음 이미 데이타는 있으므로 무조건 True가 나와야 하는데 false로 인식됨

보통 데이타가 50~100개가 움직임

예상으로는 루프돌시 쿼리셋이 동작이 안되지 않는가 추측함

procedure TDM1.SaveLeagueResult(AThread: TIdPeerThread;  CommBlock: TTransMsg; memStream: TMemoryStream);

var

   sSql, s : string;

   gameResult : TgameResult;

   SDBPool : TDBPool;

begin

   SDBPool := DBConnect;

   try

       memStream.Position := 0;

       While ( (memStream.Position + sizeof(TgameResult)) <= memStream.Size ) do

       begin

          memStream.ReadBuffer(gameResult, sizeof(TgameResult));

          with SDBPool.TempQuery do

          begin

            Active := False;

            SQL.Clear;                              //TorL추가함 서로가 리그에서도 만나고 토나먼트에서도 만날수 있다. kim 2014.1.18

            sSql := 'select * from gameresult where (Rally_Srl = :pRally_Srl) and (gameitemcode = :pGameItemcode) and  ' +

                  ' (TorL = :pTorL) and (round = :pRound) and ( singleorTeam = :pSingleorTeam )  and ' ;

            SQL.Add(sSql);

            ParamByName('pRally_Srl').Asinteger       :=  gameResult.Rally_Srl          ;

            ParamByName('pGameitemcode').Asinteger    :=  gameResult.Gameitemcode       ;

            ParamByName('pSingleorTeam').AsString     :=  gameResult.singleorTeam         ;

            ParamByName('pTorL').AsString             :=  gameResult.TorL         ;

            ParamByName('pRound').AsInteger           :=  0         ;

            Active := True;

 

            if (SDBPool.TempQuery.Locate('Winnerid;', varArrayof([gameResult.Winnerid] ), [loCaseInsensitive]) = False) and

               (SDBPool.TempQuery.Locate('Loserid;', varArrayof([gameResult.Loserid]), [loCaseInsensitive]) = False) then begin

               Active := False;

               SQL.Clear;

               SQL.Add(' insert gameresult');

               SQL.Add(' (Rally_Srl, Gameitemcode, gameitemtitle, Winnerid, WinnerName, winnerBusu, winnerset, Winnerdonghoid, WinnerdonghoName, Loserid, LoserName, Loserbusu, Loserset, Loserdonghoid, LoserdonghoName , round, roundresult,');

               SQL.Add('  singleorTeam, WriterID, memo, regdate, componame, TorL, isTeamMember) values ');

               SQL.Add('(:pRally_Srl, :pGameitemcode, :pgameitemtitle, :pWinnerid, :pWinnerName, :pwinnerBusu, :pwinnerset, :pWinnerdonghoid, :pWinnerdonghoName,:pLoserid,');

               SQL.Add(':pLoserName, :pLoserbusu, :pLoserset, :pLoserdonghoid, :pLoserdonghoName,:pround, :proundresult, :psingleorTeam, :pWriterID, :pMemo,:pRegdate, :pcomponame, :pTorL, :pisTeamMember)' );

               ParamByName('pRally_Srl').Asinteger       :=  gameResult.Rally_Srl          ;

               ParamByName('pGameitemcode').Asinteger    :=  gameResult.Gameitemcode       ;

               ParamByName('pgameitemtitle').AsString    :=  gameResult.gameitemtitle       ;

               ParamByName('pWinnerid').AsInteger        :=  gameResult.Winnerid             ;

               ParamByName('pWinnerName').AsString       :=  gameResult.WinnerName          ;

               ParamByName('pwinnerBusu').AsString       :=  gameResult.winnerBusu         ;

               ParamByName('pwinnerset').AsInteger       :=  gameResult.winnerset         ;

               ParamByName('pWinnerdonghoid').AsInteger  :=  gameResult.Winnerdonghoid    ;

               ParamByName('pWinnerdonghoName').AsString  :=  gameResult.WinnerdonghoName    ;

               ParamByName('pLoserid').AsInteger         :=  gameResult.Loserid           ;

               ParamByName('pLoserName').AsString        :=  gameResult.LoserName         ;

               ParamByName('pLoserbusu').AsString        :=  gameResult.Loserbusu         ;

               ParamByName('pLoserset').AsInteger        :=  gameResult.Loserset          ;

               ParamByName('pLoserdonghoid').AsInteger   :=  gameResult.Loserdonghoid     ;

               ParamByName('pLoserdonghoName').AsString   :=  gameResult.LoserdonghoName  ;

               ParamByName('pround').AsInteger           :=  gameResult.round             ;

               ParamByName('proundResult').AsInteger     :=  gameResult.roundResult       ;

               ParamByName('psingleorTeam').AsString     :=  gameResult.singleorTeam      ;

               ParamByName('pwriterid').AsString         :=  gameResult.writerID          ;

               ParamByName('pMemo').AsString             :=  gameResult.memo;

               ParamByName('pregdate').AsDatetime        :=  Now;              ;

               ParamByName('pcomponame').AsString        :=  gameResult.componame ;//저장되는 박스 위치

               ParamByName('pTorL').AsString              :=  gameResult.TorL         ; //토나먼트인지 리그인지 구별하는 인자

               ParamByName('pisTeamMember').AsString  :=  gameResult.isTeamMember; //토나먼트에서 단체전 결과이므로 필요없다.

               ExecSQL;

             end else begin//발견하면 경기결과를 수정해야 한다.

               Active := False;

               SQL.Clear;

               SQL.Add(' update gameresult set ');

               SQL.Add(' Rally_Srl := :pRally_Srl, Gameitemcode := :pGameitemcode, gameitemtitle := :pgameitemtitle , Winnerid := :pWinnerid, ' +

                   ' WinnerName := :pWinnerName , winnerBusu := :pwinnerBusu, winnerset := :pwinnerset, Winnerdonghoid := :pWinnerdonghoid , ' +

                   ' WinnerdonghoName := :pWinnerdonghoName, Loserid := :pLoserid, LoserName := :pLoserName, Loserbusu := :pLoserbusu, Loserset := :pLoserset, ' +

                   ' Loserdonghoid := :pLoserdonghoid , LoserdonghoName := :pLoserdonghoName, round := :pround, roundresult := :proundresult, ' +

                   ' singleorTeam := :psingleorTeam, WriterID := :pWriterID, memo := :pMemo, regdate := :pRegdate, componame := :pcomponame, TorL := :pTorL, ' +

                   ' isTeamMember := :pisTeamMember ' +

                   ' where (Rally_Srl = :pRally_Srl) and (gameitemcode = :pGameItemcode) and  ' +

                   ' (TorL = :pTorL) and (round = :pRound) and ( singleorTeam = :pSingleorTeam ) and ' +

                   ' (winnerid = :pWinnerid) and ( loserid = :pLoserid )  ' );

               ParamByName('pRally_Srl').Asinteger       :=  gameResult.Rally_Srl          ;

               ParamByName('pGameitemcode').Asinteger    :=  gameResult.Gameitemcode       ;

               ParamByName('pgameitemtitle').AsString    :=  gameResult.gameitemtitle       ;

               ParamByName('pWinnerid').AsInteger        :=  gameResult.Winnerid             ;

               ParamByName('pWinnerName').AsString       :=  gameResult.WinnerName          ;

               ParamByName('pwinnerBusu').AsString       :=  gameResult.winnerBusu         ;

               ParamByName('pwinnerset').AsInteger       :=  gameResult.winnerset         ;

               ParamByName('pWinnerdonghoid').AsInteger  :=  gameResult.Winnerdonghoid    ;

               ParamByName('pWinnerdonghoName').AsString  :=  gameResult.WinnerdonghoName    ;

               ParamByName('pLoserid').AsInteger         :=  gameResult.Loserid           ;

               ParamByName('pLoserName').AsString        :=  gameResult.LoserName         ;

               ParamByName('pLoserbusu').AsString        :=  gameResult.Loserbusu         ;

               ParamByName('pLoserset').AsInteger        :=  gameResult.Loserset          ;

               ParamByName('pLoserdonghoid').AsInteger   :=  gameResult.Loserdonghoid     ;

               ParamByName('pLoserdonghoName').AsString   :=  gameResult.LoserdonghoName  ;

               ParamByName('pround').AsInteger           :=  gameResult.round             ;

               ParamByName('proundResult').AsInteger     :=  gameResult.roundResult       ;

               ParamByName('psingleorTeam').AsString     :=  gameResult.singleorTeam      ;

               ParamByName('pwriterid').AsString         :=  gameResult.writerID          ;

               ParamByName('pMemo').AsString             :=  gameResult.memo;

               ParamByName('pregdate').AsDatetime        :=  Now;              ;

               ParamByName('pcomponame').AsString        :=  gameResult.componame ;//저장되는 박스 위치

               ParamByName('pTorL').AsString              :=  gameResult.TorL         ; //토나먼트인지 리그인지 구별하는 인자

               ParamByName('pisTeamMember').AsString  :=  gameResult.isTeamMember; //토나먼트에서 단체전 결과이므로 필요없다.

               ExecSQL;

             end;

          end;

       end;//while

 

       try

          CommBlock.Size := memStream.Size;

          AThread.Connection.WriteBuffer(CommBlock, SizeOf(CommBlock), True);

          AThread.Connection.WriteBuffer(memStream.memory^, memStream.Size, True);

       except

          AThread.Connection.DisConnect;

       end;

 

   finally

     DBDisConnect(SDBPool);

   end;

end;

[Top]
No.
제목
작성자
작성일
조회
30944mysql과 c++ 연동 할떄 컴파일 오류나요 ㅠㅠ
헬픔요
2016-04-06
6295
30942Mysql 웹접속은 되는데 tcp ip로 접속이 안됩니다 [1]
RayYun
2016-04-01
6474
30940도와 주세요""" My-SQL 에 대하여
신경식
2016-03-24
6409
30939mysql자료를 한번봐주셔요 이게 루프에서 첫번째는 억는데 다음 루프때는 먹지 않음 이미 데이타는 있으므로 무조건 True가 나와야 하는데 false로 인식됩니다. 부탁드립니다.
임기섭
2016-03-21
7958
30937mariadb 재부팅시 초기화가 됩니다...
박창훈
2016-03-19
7078
30936mariadb를 sqlyog프로그램에서 컨트롤할때 경고문이 뜨는데 혹시 해결방법 아시는 분...
궁금이
2016-03-18
6324
30935리눅스 mysql ERROR 1045(28000)
정재완
2016-03-17
6158
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.048초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다