admin管理员组文章数量:1335122
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;
本文标签: multithreadingIssue with concurrent database calls Using ZeosLibStack Overflow
版权声明:本文标题:multithreading - Issue with concurrent database calls Using ZeosLib - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742349742a2458247.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论