Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Parameter type changes (bug report?)
Parameter type changes (bug report?)
Posted: 2005/09/30 19:54
 
Here is a little bit of code:
someStaticQuery.Close;
someStaticQuery.ParamByName('SomeParam').AsString := SomeValue;
someStaticQuery.Open;

As one can see, I have a static query (it is positioned on the form). Before assignment, parameter 'SomeParam' has the type ftInteger. After assignment is has the type ftString. And this causes Oracle to throw an exception "Must reparse cursor to change bind variable type". I agree with this message, but why does the type change? I've traced down the code, until I've found the method TOciParam.SetAsStrings. And here lies the source of this problem. Here is the direct quotation from the original source:
if ODataType in [otString, otChar] then
SetData(AIndex, pUb1(PChar(Value)), Length(Value), ODataType)
else
SetData(AIndex, pUb1(PChar(Value)), Length(Value), otString);
SetData forces the parameter type to be otString! And IMHO this shouldn't happen (well, with BDE it worked perfectly).