[freetds] freebcp: add support for escaping characters?
Konrad J Hambrick
konrad at jax01.payplus.com
Wed Mar 29 09:41:46 EST 2006
Thanks for the great feedback, James !
And thanks again for all the great work
on freetds !
-- kjh
James K. Lowden wrote:
> Konrad J Hambrick wrote:
>
>>What does freebcp do when say, a char (or varchar) field
>>contains an embedded freebcp (field or record) delimiter char ?
>
>
> As far as freebcp is concerned, there's no such thing as a delimiter
> embedded in the data. You have data, and between the data you have
> delimiters. When it sees a delimiter, it marks the end of that field and
> the beginning of the next.
>
> Granted, that causes sometimes confusing errors, because partway through
> processing your 6-column file it will find "7" columns, often eventually
> ending with an error about not being able to convert to type X.
>
> OTOH, in years of dealing with this stuff, I've never truly been stuck for
> a delimiter. Normally, I use '\', because it has no place in English
> prose. If I do find that character in the data, I can safely change it to
> '/'. Similarly, most of the data I work with doesn't have tabs and
> newlines, so they're fine delimiters, too. freebcp supports an ASCII NUL
> delimiter these days; I bet you won't find that in your character data.
>
> If I were really stuck, I could always use multicharacter sequence
> delimiters. '$%^', for example, would do pretty well.
>
> For my money, quoting and escaping are too error-prone, too apt to alter
> the data. Sooner or later you'll wind up with escapes in the database.
> If you've ever seen email with '>From' in it, you know what I'm talking
> about.
>
> Regards,
>
> -jkl
>
More information about the FreeTDS
mailing list