Date formats with TOracleDirectPathLoader

Hi there

I know you're meant to be able to use dates with the path loader, but I can't seem to get it working.

I'm setting the Loader.DateFormat to 'dd/mm/yyyy' and the code that sets the column data is as follows:

Value := FormatDateTime('dd/mm/yyyy', DateValue);
Loader.ColumnByName(ColName).SetData(RowIndex, @Value[1], Length(Value));

where DateValue is a TDateTime and ColName is a date field name.

The error the loader throws is this:

ORA-26093: input data column size (10) exceeds the maximum input size (9)

Any advice appreciated.

Cheers
Tom
 
Ah.. I think I've figured out my problem. I have wrapped the code to set values within a procedure, so for each call the set data I'm only recording the address of the reference variable. Because the procedure for setting dates using the matching procedure for setting strings, when the date column gets updated it uses the last string entry.

Do I feel stupid or what?

Cheers
Tom
 
Hmm.. well I still feel stupid.. This fixed the problem for strings, integers, etc. but dates still give me the same error message. I can't for the life of me figure it out.

Any help appreciated.

Cheers
Tom
 
Note that the SetData function does not copy the data, but merely assigns a data pointer and length to a cell in the loader array. When Load is called, this piece of memory still needs to hold the actual data, and this is probably not the case here. The DirectPath Demo project defines an internal collection class to hold a batch of record data, which is then loaded. Maybe you can use this as a guideline.
 
I'm assuming that the date data is still stored in memory as a string until it's loaded. I've changed my code to copy all string, int and float data into a buffer and am pointing the loader at the buffer memory. This works fine for everything except for dates. The code for copy string data looks a bit like this:

BuffAddr := Longword(Buffer) + BufferOffset;
Buf := Ptr(BuffAddr);
StrCopy(Buf, PChar(Value));
Loader.ColumnByName(ColName).SetData(RowIndex, Buf, BufLength);

Where Buffer is the general grab-bag of values. This works fine for strings, but weirdly not for dates - even though setting dates uses the same method.

I'll keep stabbing at it, but am I incorrect that date data is stored as a string in memory? Do I need to set the actual column's date format property (I've set it for the loader itself).

Cheers
Tom
 
Setting the date format at the loader level should be sufficient. You could try to set it at the column level just to be sure.

The date data is stored in memory in the format that you have defined. This needs to match the DateFormat property.
 
Back
Top