I have a problem with a function that interacts with the database. When I call it sequentially, it works perfectly, but when I call it concurrently, it gives me an error.
Is ZeosLib not thread-safe, and how can I fix this issue? I don't want to create a new connection each time I call the function, as I'm using a single connection for all requests.
I'm using Firebird, Delphi 12, and ZeosLib 6.5.1 (alpha).
Here is the function I am using:
procedure TestFunction;
var
Query: TZEOSQuery;
begin
Query := TZEOSQuery.Create(nil);
try
Query.Connection := MyConn;
MyConn.StartTransaction;
Query.SQL.Text := 'SELECT * FROM project';
Query.Open;
while not Query.EOF do
begin
Query.Next;
end;
MyConn.Commit;
finally
Query.Close;
Query.Free;
end;
end;
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742349742a4427272.html
评论列表(0条)