Incorrect dataparameter type in the update and insert calls

We are having some errors on updates and inserts where the parameter datatype is incorrect.

Where or what function is called in DataAbstract to assign the datatype, etc for the data parameters for the sql statement?

The specific data items are all strings but seem to be coming back as numeric. Does the function look at the schema itself or the actual database fields? Or the datatable field descriptions?

We are using the FireDAC driver. But this is a very similar problem that we encountered with our own Liodden driver that we were building. Possibly the answer here may direct us to where we can modify our Linden driver.

Thanks.
Bill Brittain

Hi,

You can fix parameter type in Schema Modeler:


try to override intVCLTypeToDAType.

we do this for ODAC driver:

function TDAEODACQuery.intVCLTypeToDAType(aFieldType: TFieldType; ASize: Integer = 0; ADecimalPrecision: Integer = 0; aDecimalScale: Integer = 0): TDADataType;
begin
  if Ord(aFieldType) in [{$IF (DACVersion >= '8.2.7') or (DACVersion >= '10.0.0')}ftOraTimeStampTZ, ftOraTimeStampLTZ{$ELSE}ftTimeStampTZ, ftTimeStampLTZ{$IFEND}] then
    aFieldType := ftTimeStamp;
  if Ord(aFieldType) in [ftBFile] then aFieldType := ftBlob;
  if Ord(aFieldType) = ftXML then aFieldType := {$IFNDEF DA_WideMemoSupport}ftBlob{$ELSE}ftWideMemo{$ENDIF DA_WideMemoSupport};
  if Ord(aFieldType) in [ftNumber] then begin
    if (TSmartQuery(Dataset).Session.Options.EnableIntegers) and (aDecimalScale = 0) and (ADecimalPrecision < IntegerPrecision) then aFieldType := ftInteger
    else if (TSmartQuery(Dataset).Session.Options.EnableIntegers) and (aDecimalScale = 0) and (ADecimalPrecision < LargeIntPrecision) then aFieldType := ftLargeint
    else if (TSmartQuery(Dataset).Session.Options.EnableNumbers) and (ADecimalPrecision > FloatPrecision) then aFieldType := ftFMTBcd
    else aFieldType := ftFloat;
  end;
  Result := inherited intVCLTypeToDAType(aFieldType, ASize, ADecimalPrecision, aDecimalScale);
end;

Thanks. Will try.

Schema setup is correct so it must be somewhere the driver or DA is picking up the field datatype somewhere.