mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 03:01:07 +08:00
Throw successive result sets from stored procedures away, until we have real support for multi results. Otherwise mysql_ping() crashes on the next query. Fixes issue #1850.
This commit is contained in:
@ -492,9 +492,10 @@ end;
|
||||
}
|
||||
function TMySQLConnection.Query(SQL: String; DoStoreResult: Boolean=False; LogCategory: TMySQLLogCategory=lcSQL): PMYSQL_RES;
|
||||
var
|
||||
querystatus: Integer;
|
||||
querystatus, i: Integer;
|
||||
NativeSQL: AnsiString;
|
||||
TimerStart: Cardinal;
|
||||
NextResult: PMYSQL_RES;
|
||||
begin
|
||||
if not Ping then
|
||||
Active := True;
|
||||
@ -530,6 +531,17 @@ begin
|
||||
Log(lcDebug, IntToStr(RowsFound)+' rows found.');
|
||||
if not DoStoreResult then
|
||||
mysql_free_result(Result);
|
||||
|
||||
// No support for real multi results yet, throw them away, so mysql_ping() does not crash on the *next* query.
|
||||
i := 1;
|
||||
while mysql_next_result(FHandle) = 0 do begin
|
||||
Inc(i);
|
||||
Log(lcDebug, 'Storing and freeing result #'+IntToStr(i)+' from multiple result set ...');
|
||||
NextResult := mysql_store_result(FHandle);
|
||||
if NextResult <> nil then
|
||||
mysql_free_result(NextResult);
|
||||
end;
|
||||
|
||||
end else begin
|
||||
// Query did not return a result
|
||||
FRowsFound := 0;
|
||||
|
Reference in New Issue
Block a user