Issues with timestamps and interval types and FieldsAsString.
Posted: Wed 04 Sep 2013 13:08
Timestamps and Intervals as strings currently don't work as the buffer size isn't being set properly due to a couple of bugs in function TOCIRecordSet.GetFieldDesc8. Here's the fixed code (only the lines marked "mjf" have been changed.):
It would be nice to get this fix into the next release. Note also that the function GetNlsFieldDesc doesn't return large enough values for timestamps (they get cut by a couple of characters depending on the format.) Note also that this function also has the issue that the nls formats are cached and never update (which is a sticky issue, I just go ahead and replace the function to return 50... maybe not the best solution, but better than how it works now.)
Thanks,
Mark Ford
Benthic Software
Code: Select all
dtTimeStamp, dtTimeStampTZ, dtTimeStampLTZ,
dtIntervalYM, dtIntervalDS:
// if (Field.DataType <> dtString) then begin // mjf: original line: doesn't check for dtWideString
if ((Field.DataType <> dtString) and (Field.DataType <> dtWideString)) then begin // mjf: fixed line
Field.Length := Field.DBLength;
if Field.DataType = dtIntervalDS then
Field.Scale := Field.DBScale;
end
else
// case OraType of // mjf: original line: incorrectly checking the Oracle type SQLT_ constants instead of the odac dt* types
case Field.SubDataType of // mjf: fixed line
dtTimeStamp, dtTimeStampLTZ:
Field.Length := GetNlsFieldDesc(nlsTimeStampFormat);
dtTimeStampTZ:
Field.Length := GetNlsFieldDesc(nlsTimeStampTZFormat);
dtIntervalYM:
Field.Length := Field.DBLength + 4; // interval year to month form is +Prec-MM
dtIntervalDS:
Field.Length := Field.DBLength + Field.DBScale + 11; // interval day to second form is +Prec HH:MM:SS.Scale
end;
Thanks,
Mark Ford
Benthic Software