Problem with TIBCSQL.Execute method in multithread applicati
-
adm.nilser
- Posts: 10
- Joined: Sat 09 Jul 2011 15:53
- Location: Brasil
Problem with TIBCSQL.Execute method in multithread applicati
Hello, i'm testing the lastest IBDAC version with a multithread application, and when i try to execute TIBCSQL.Execute method i have a access violation exception.
i tested the method with a simple application, then working fine.
Any idea about this issue??
i tested the method with a simple application, then working fine.
Any idea about this issue??
-
AndreyZ
-
adm.nilser
- Posts: 10
- Joined: Sat 09 Jul 2011 15:53
- Location: Brasil
-
AndreyZ
-
adm.nilser
- Posts: 10
- Joined: Sat 09 Jul 2011 15:53
- Location: Brasil
-
AndreyZ
The point is that the client library can be not threadsafe, and that can cause different random errors in a multithreaded application. The EnsureThreadSafety variable helps to avoid these errors. If the client library isn't threadsafe, IBDAC implements thread-safety by itself. For example, if you are using Firebird 2.5, IBDAC won't implement thread-safety by itself, but if you are using any previous Firebird version, IBDAC will implement thread-safety.
to imeyer:
In the latest IBDAC version 3.60.0.24 we fixed the problem with the EnsureThreadSafety variable for RAD Studio 2009 and higher. Please try using the IBDAC version 3.60.0.24 and check if the problem persists.
to adm.nilser:
The problem you described can be caused by different reasons. That's why it's better if you compose a small sample that demonstrates this problem and send it to me. This way I will be able to investigate the problem and find a solution. Please provide me all information I asked you in my previous post.
to imeyer:
In the latest IBDAC version 3.60.0.24 we fixed the problem with the EnsureThreadSafety variable for RAD Studio 2009 and higher. Please try using the IBDAC version 3.60.0.24 and check if the problem persists.
to adm.nilser:
The problem you described can be caused by different reasons. That's why it's better if you compose a small sample that demonstrates this problem and send it to me. This way I will be able to investigate the problem and find a solution. Please provide me all information I asked you in my previous post.
-
adm.nilser
- Posts: 10
- Joined: Sat 09 Jul 2011 15:53
- Location: Brasil
Hi, I discovered the problem. It's occurs when I try to use blob params.
I implemented a class inherited from TIBCQuery called TIBXQuery that declares a method called SetParam.
TIBXQuery = class(TIBCQuery)
public
procedure SetParam(AParam: String; AValue: Variant; AType: TFieldType);
end;
The SetParam method's code is:
procedure TIBXQuery.SetParam(AParam: String; AValue: Variant; AType: TFieldType);
var
lParam: TParam;
begin
lParam := ParamByName(AParam);
lParam.DataType := AType;
lParam.Value := AValue;
end;
If local variable lParam is a blob param, a exception occurs.
This method only works if I change the AValue parameter's type to String and set lParam variable as lParam.AsMemo := AValue;
I'm using the version 3.60.0.24 of IBDAC.
Any sugestion??
I implemented a class inherited from TIBCQuery called TIBXQuery that declares a method called SetParam.
TIBXQuery = class(TIBCQuery)
public
procedure SetParam(AParam: String; AValue: Variant; AType: TFieldType);
end;
The SetParam method's code is:
procedure TIBXQuery.SetParam(AParam: String; AValue: Variant; AType: TFieldType);
var
lParam: TParam;
begin
lParam := ParamByName(AParam);
lParam.DataType := AType;
lParam.Value := AValue;
end;
If local variable lParam is a blob param, a exception occurs.
This method only works if I change the AValue parameter's type to String and set lParam variable as lParam.AsMemo := AValue;
I'm using the version 3.60.0.24 of IBDAC.
Any sugestion??
-
AndreyZ
To solve the problem, you should use TIBCParam instead of TParam in the following way:
Code: Select all
procedure TIBXQuery.SetParam(AParam: String; AValue: Variant; AType: TFieldType);
var
lParam: TIBCParam;
begin
lParam := ParamByName(AParam);
lParam.DataType := AType;
lParam.Value := AValue;
end;-
adm.nilser
- Posts: 10
- Joined: Sat 09 Jul 2011 15:53
- Location: Brasil