mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
* Checking for MaxRows (guess: max rows to load) != 0 before checking whether the requested row is out of range seems unreasonable, since asking for a maximum of 0 rows is not uncommon. Change the default value to -1, and change the checks to look for -1, allowing for MaxRows := 0.
* There seems to be disagreement between drivers on whether to check for Row > MaxRows or Row >= MaxRows. Guessing that it's a typo, change to the most common variant (Row >= MaxRows, meaning that the row numbers given to MoveAbsolute, MoveRelative, Next, Fetch etc are 0-based).
This commit is contained in:
@ -1528,8 +1528,7 @@ begin
|
|||||||
if IsUniDirectional then
|
if IsUniDirectional then
|
||||||
Statement.SetResultSetType(rtForwardOnly)
|
Statement.SetResultSetType(rtForwardOnly)
|
||||||
else Statement.SetResultSetType(rtScrollInsensitive);
|
else Statement.SetResultSetType(rtScrollInsensitive);
|
||||||
if MaxRows > 0 then
|
Statement.SetMaxRows(MaxRows);
|
||||||
Statement.SetMaxRows(MaxRows);
|
|
||||||
|
|
||||||
if doSmartOpen in FOptions then
|
if doSmartOpen in FOptions then
|
||||||
begin
|
begin
|
||||||
|
@ -575,7 +575,7 @@ end;
|
|||||||
function TZASAResultSet.MoveAbsolute(Row: Integer): Boolean;
|
function TZASAResultSet.MoveAbsolute(Row: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (Row >= MaxRows) then
|
if (MaxRows > -1) and (Row >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
FASAConnection.GetPlainDriver.db_fetch( FASAConnection.GetDBHandle,
|
FASAConnection.GetPlainDriver.db_fetch( FASAConnection.GetDBHandle,
|
||||||
@ -601,7 +601,7 @@ end;
|
|||||||
function TZASAResultSet.MoveRelative(Rows: Integer): Boolean;
|
function TZASAResultSet.MoveRelative(Rows: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and ( Abs( RowNo) + Rows >= MaxRows) then
|
if (MaxRows > -1) and ( Abs( RowNo) + Rows >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
FASAConnection.GetPlainDriver.db_fetch( FASAConnection.GetDBHandle,
|
FASAConnection.GetPlainDriver.db_fetch( FASAConnection.GetDBHandle,
|
||||||
|
@ -1736,7 +1736,7 @@ var
|
|||||||
TempRow: PZRowBuffer;
|
TempRow: PZRowBuffer;
|
||||||
begin
|
begin
|
||||||
Result := FResultSet.Next;
|
Result := FResultSet.Next;
|
||||||
if not Result or ((MaxRows > 0) and (LastRowNo >= MaxRows)) then
|
if not Result or ((MaxRows > -1) and (LastRowNo >= MaxRows)) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
TempRow := RowAccessor.RowBuffer;
|
TempRow := RowAccessor.RowBuffer;
|
||||||
@ -1928,7 +1928,7 @@ function TZCachedResultSet.MoveAbsolute(Row: Integer): Boolean;
|
|||||||
begin
|
begin
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (Row > MaxRows) then
|
if (MaxRows > -1) and (Row >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
{ Processes negative rows }
|
{ Processes negative rows }
|
||||||
|
@ -547,7 +547,7 @@ var
|
|||||||
begin
|
begin
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (LastRowNo >= MaxRows) then
|
if (MaxRows > -1) and (LastRowNo >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
{ Fetch row. }
|
{ Fetch row. }
|
||||||
|
@ -791,7 +791,7 @@ begin
|
|||||||
|
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (Row > MaxRows) then
|
if (MaxRows > -1) and (Row >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if not FUseResult then
|
if not FUseResult then
|
||||||
@ -837,7 +837,7 @@ function TZMySQLResultSet.Next: Boolean;
|
|||||||
begin
|
begin
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (RowNo >= MaxRows) then
|
if (MaxRows > -1) and (RowNo >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
FRowHandle := FPlainDriver.FetchRow(FQueryHandle);
|
FRowHandle := FPlainDriver.FetchRow(FQueryHandle);
|
||||||
|
@ -886,7 +886,7 @@ var
|
|||||||
begin
|
begin
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (RowNo > LastRowNo) or ((MaxRows > 0) and (RowNo >= MaxRows)) then
|
if (RowNo > LastRowNo) or ((MaxRows > -1) and (RowNo >= MaxRows)) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if RowNo = 0 then
|
if RowNo = 0 then
|
||||||
|
@ -636,7 +636,7 @@ begin
|
|||||||
|
|
||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
if (MaxRows > 0) and (Row > MaxRows) then
|
if (MaxRows > -1) and (Row >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
{ Processes negative rows. }
|
{ Processes negative rows. }
|
||||||
|
@ -356,7 +356,7 @@ begin
|
|||||||
FResultSetConcurrency := rcReadOnly;
|
FResultSetConcurrency := rcReadOnly;
|
||||||
FPostUpdates := poColumnsAll;
|
FPostUpdates := poColumnsAll;
|
||||||
FLocateUpdates := loWhereAll;
|
FLocateUpdates := loWhereAll;
|
||||||
FMaxRows := 0;
|
FMaxRows := -1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -734,7 +734,7 @@ begin
|
|||||||
{ Checks for maximum row. }
|
{ Checks for maximum row. }
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
if (MaxRows > 0) and (RowNo >= MaxRows) then
|
if (MaxRows > -1) and (RowNo >= MaxRows) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if LastRowNo = 0 then
|
if LastRowNo = 0 then
|
||||||
|
Reference in New Issue
Block a user