Use TADOQuery and TDataSetProvider can meet SQL provider: CommonUse
I call on the client CommonUse
Through the SQL statements in
Common problem using
In order to test performance,
Var
TMPCNT, I: Integer;
Tmstart tmfinish: TDateTime;
The begin
If for the. Enabled then
The begin
Button1Click (Sender);
end;
TMPCNT:=StrToInt (EditPort. Text);
Try
For I:=1 to TMPCNT do
The begin
Application. ProcessMessages;
If 1 & gt; RandomRange (0, 9) then
The begin
Cds_List. Close;
Tmstart:=Now;
MemoAddText (IntToStr (I) + ': begin to access | | start time:' + FormatDateTime (hh: mm: ss, tmstart));
Cds_List. Open;
Tmfinish:=Now;
MemoAddText (IntToStr (I) + ': complete access | | end time:'
+ FormatDateTime (hh: mm: ss, tmfinish) + '| | time-consuming:'
+ FormatDateTime (hh: mm: ss, tmfinish - tmstart));
end;
end;
Except,
On e: the exception do
The begin
Application. MessageBox (pchar (e.M essage), 'Error', 0).
end;
end;
end;
I enter 20000 in the EditPort
Then start cycle
In the process of circulation
On the server will appear many times the List index out of bounds of tip
As shown in figure,
CodePudding user response:
This kind of problem should be able to find the problem, carefully check or debug program,CodePudding user response:
Through debugging, found that code reported anomalies isThe code below
The function TRODataSnapBaseAppServer. AS_GetRecords (const ProviderName: WideString; Const Count: Integer; The out RecsOut: Integer; Const Options: Integer; Const CommandText: WideString; Var Params: Binary; Var OwnerData: AnsiString) : binary;
Var lProvider: TCustomProvider;
LOwnerData lParams: OleVariant;
The begin
{$IFDEF DEBUG_REMOBJECTS_DATASNAP}
DebugServer. EnterMethodEx (self, 'IAppServer. AS_GetRecords (ProviderName=% s, Count=% d, the Options=% d, CommandText)=% s', [string (ProviderName), Count, Options, CommandText]); Try
Try
{$ENDIF DEBUG_REMOBJECTS_DATASNAP}
LProvider:=GetProviderByName (ProviderName);
//result:=BinaryFromVariant (lProvider GetRecords (Count, RecsOut, Options));
LOwnerData:=OwnerData;
LParams:=VariantFromBinary (Params);
Result:=BinaryFromVariant (lProvider. GetRecords (Count, RecsOut, Options, CommandText lParams, lOwnerData));
FreeAndNil (Params);
Params:=BinaryFromVariant (lParams);
OwnerData:=VarToAnsiStr (lOwnerData);
{$IFDEF DEBUG_REMOBJECTS_DATASNAP}
Except DebugServer. WriteException (); Raise; end;
The finally DebugServer. ExitMethodEx (self, 'IAppServer. AS_GetRecords (RecsOut=% d) ", [RecsOut]); end;
{$ENDIF DEBUG_REMOBJECTS_DATASNAP}
end;
Is
Result:=BinaryFromVariant (lProvider. GetRecords (Count, RecsOut, Options, CommandText lParams, lOwnerData));
This line of code
I tried with abnormal protect
Is
Try
Except,
end;
But this exception to outside
Estimation is I didn't find the right place
Do you have any which adults know how to solve this problem
CodePudding user response: