Firebird - problem with ftBytes
Posted: Thu 21 Aug 2014 13:27
My database field is 16 bytes for a guid:
MYGUID CHAR(16) CHARACTER SET OCTETS
For insert / update I initialize the TUniParam like this:
param.DataType := ftBytes;
param.ParamType := ptInput;
param.Clear;
This is all if the parameter should be set to null.
Now I get an access violation when the TUniQuery should be destroyed. The problem happens in TIBCParamDesc.FreeBuffer for my guid parameter on this line:
Marshal.FreeHGlobal(FValue);
Earlier FValue was allocated a buffer, but only one byte.
What I found is in TIBCParamDesc.SetNull, is the following line that is executed for my guid param object:
Marshal.WriteInt16(FValue, 0);
So this means, two bytes are written here to a buffer of one byte size. Not sure, if something is wrong in my initial code for setting the param or if this is a problem in the UniDac library.
cu Christian
MYGUID CHAR(16) CHARACTER SET OCTETS
For insert / update I initialize the TUniParam like this:
param.DataType := ftBytes;
param.ParamType := ptInput;
param.Clear;
This is all if the parameter should be set to null.
Now I get an access violation when the TUniQuery should be destroyed. The problem happens in TIBCParamDesc.FreeBuffer for my guid parameter on this line:
Marshal.FreeHGlobal(FValue);
Earlier FValue was allocated a buffer, but only one byte.
What I found is in TIBCParamDesc.SetNull, is the following line that is executed for my guid param object:
Marshal.WriteInt16(FValue, 0);
So this means, two bytes are written here to a buffer of one byte size. Not sure, if something is wrong in my initial code for setting the param or if this is a problem in the UniDac library.
cu Christian