WYAE - FWTOOLS Mailing List Archive


Re: [fwtools] Suggestion - Null Values in Templates
From:Volker Tanger
Date: Tue, 19 Oct 2004 22:43:33 +0200

Greetings!

On Thu, 7 Oct 2004 19:48:02 +0200
Reto Schuettel  wrote:

> > I use Templates to Load into MySQL 
> Hm, you could use the templates for creating sql code directly :)?

*grin* you were faster than me with this comment...  ;-)


> > Accordingly, at times I need to find fields that have "null" (
> > empty) values.  
> >  
> > Perhaps a change in code around line 3267
> > 
> > ## For DB Nulls
> >         if ( $access_comment[$i] ) {
> >         $line =~ s/<<>>/$access_comment[$i]/g;
> >         }  else {
> >         $line =~ s/<<>>/NULL/g;
> 
> Hm, in my opinion this solution is quiet ugly, because it breaks
> everything :). You have to implement that as an optional parameter,
> like--print-nulls or something like that, you should never change the
> default behavior!

Seconded. But another otion added onto that bunch of what we already 
have today? I'd prefer... (below)


> # perl -i -pe 's/\t\t/\tNULL\t/g' output.tsv # these both commands
> # perl -i -pe 's/\t\n/\tNULL\n/g' output.tsv # replaces all the empty
>                                              # strings with NULL

As you're (probably) massaging the TSV file with a Perl script anyway 
replacing "" with "NULL" should not be so much of a problem - I hope?

As NULL only has this one special meaning in connection with MySQL it
will not be compatible with (any) other projects using FW1Rules' output.
So I'd prefer to stay with the "just empty as it is" way.

Bye
	Volker


-- 

Volker Tanger	volker.tanger@wyae.de
-===================================-
Research & Development Division, WYAE


--- StripMime Report -- 
Plain text mail. Excellent! Won't be converted or stripped.
---