Subject | Re: [IBO] Re: Tib_Import doesn't fail/throw exception when data type is incorrect ? |
---|---|
Author | Jason Wharton |
Post date | 2009-08-25T18:22:49Z |
Samh,
I am not aware of any other mechanism to deal with this. It would be nice to
have a setting to go either way on this. Many wouldn't want the import
halted over bad data but others may absolutely want it halted if there is
bad data.
Let me know what you come up with. It might be something that can remain a
permanent feature so people in the future will be able to deal with this
better.
Thanks,
Jason Wharton
> Any assistance with this issue/suggestions is appreciated, I am working toI think hacking around in there is going to be your best bet at this point.
> a deadline and need to get this problem solved.
>
> If the first row in the csv file contains an invalid date then that date
> will end up in the database table date column as null, eg :
>
> 1,sdfsdf,ELLEN,HUNTER,February
> 2,07/26/2007,RACHEL,BREWER,March
> 3,12/21/2007,ELSIE,MEDINA,July
> 4,01/02/2009,JESSICA,DOUGLAS,January
>
> Row 1 is inserted with a null date.
>
> If the invalid date is not on the first row it will be given the date
> value of the preceeding row eg :
>
> 1,12/21/2007,ELLEN,HUNTER,February
> 2,sdsd,RACHEL,BREWER,March
> 3,12/21/2007,ELSIE,MEDINA,July
> 4,01/02/2009,JESSICA,DOUGLAS,January
>
> Row 2 is inserted with a date value of 12/21/2007, it has inherited that
> date value from row 1!
>
> What I would like to happen is for the TIB_Import to throw an exception or
> report an error if a value in the csv going into a
> date column is not a valid date.
>
> I have taken a look at IB_Import.pas and think the relevant area is
> around line 1203 :
> DSql.Params[p].AsString := AsciiFields[ii];
>
> I can hack around in there and try and add some type checking (in my case
> I only need it for dates), but i wonder if there is already a mechanism
> available.
I am not aware of any other mechanism to deal with this. It would be nice to
have a setting to go either way on this. Many wouldn't want the import
halted over bad data but others may absolutely want it halted if there is
bad data.
Let me know what you come up with. It might be something that can remain a
permanent feature so people in the future will be able to deal with this
better.
Thanks,
Jason Wharton