mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:06:08 +02:00
* Fixed resource-leak on exceptions during creating/dropping databases, patch from taka_jp, bug #13587
git-svn-id: trunk@13190 -
This commit is contained in:
parent
2435a4a48f
commit
d39e82b256
@ -310,18 +310,21 @@ begin
|
||||
|
||||
InitialiseMysql;
|
||||
|
||||
H:=HostName;
|
||||
U:=UserName;
|
||||
P:=Password;
|
||||
AMySQL := nil;
|
||||
ConnectMySQL(AMySQL,pchar(H),pchar(U),pchar(P));
|
||||
|
||||
if mysql_query(AMySQL,pchar(query))<>0 then
|
||||
MySQLError(AMySQL,Format(SErrExecuting,[StrPas(mysql_error(AMySQL))]),Self);
|
||||
|
||||
mysql_close(AMySQL);
|
||||
|
||||
ReleaseMysql;
|
||||
try
|
||||
H:=HostName;
|
||||
U:=UserName;
|
||||
P:=Password;
|
||||
AMySQL := nil;
|
||||
ConnectMySQL(AMySQL,pchar(H),pchar(U),pchar(P));
|
||||
try
|
||||
if mysql_query(AMySQL,pchar(query))<>0 then
|
||||
MySQLError(AMySQL,Format(SErrExecuting,[StrPas(mysql_error(AMySQL))]),Self);
|
||||
finally
|
||||
mysql_close(AMySQL);
|
||||
end;
|
||||
finally
|
||||
ReleaseMysql;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TConnectionName.EscapeString(const Str: string): string;
|
||||
|
Loading…
Reference in New Issue
Block a user