Skip to Content.
Sympa Menu

freetds - Re: [freetds] freebcp: add support for escaping characters?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: galt AT folkplanet.com
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] freebcp: add support for escaping characters?
  • Date: 31 Mar 2006 12:39:32 -0800


Rats, the emailer re-formatted my text layout, I'll try again:

If you gave freebcp a way to express nulls, e.g.
-Null '' (equivalent to what happens now)

-Null '"NULL"' (actually this is probably not a useful example)
-Null 'NULL' (great for csv) -Null '\N' (great for mysql with custom field/line separator strings)

etc, then the user could get what he needs.


On Mar 31 2006, galt AT folkplanet.com wrote:


It would be nice to be able to say how the NULL value
should be expressed. Currently it looks like an unquoted empty string, i.e. if your separator is <my#$#@separator><my#$#@separator>.
MySQL 5 load data local infile will give a bunch of warnings with scary messages like out of range value
and data truncated. For CSV, it would like to see
unquoted NULL (i.e. the only thing that ISN'T quoted), and for special separator strings (non-csv), it wants it to be escaped as \N.
If you gave freebcp a way to express nulls, e.g. -Null '' (equivalent to what happens now) -Null '"NULL"' (actually this is probably not a useful example) -Null 'NULL' (great for csv) -Null '\N' (great for mysql with custom field/line separator strings) etc, then the user could get what he needs.

Right now I am having to write a custom program to do this because sed is bombing out on big input files
(several tables around 6GB).

Plus, even then, it will end up turning all "" into NULL.

-Galt



On Mar 31 2006, Bort, Paul wrote:

> > > > Ahem. I understand they're technically different, of course, > > but how are
> > they semantically different? Which user can tell the > > difference between a
> > null field and a zero-length string? And what is the > > difference between
> > an empty field and a field that's empty? > > > > Just a quick example from my current project of how '' and NULL are
> different and that difference can be important:
> > We have a table that holds user settings, and a null ( or a missing row
> ) means that the default (from a separate table) should be used. OTOH,
> if the column is an empty string, that means that the setting should be
> an empty string, even if the default says otherwise. If a setting is a
> file prefix, an empty string is a reasonable value.
> > _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page