WYAE - FWTOOLS Mailing List Archive
| Suggestion - Null Values in Templates
|
| From: | "WISNIEWSKI, DANIEL (SBCSI)" |
| Date: | Thu, 7 Oct 2004 10:16:33 -0400
|
=20
Greetings :=20
=20
ITEM 1=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
I use Templates to Load into MySQL=20
=20
Accordingly, at times I need to find fields that have "null" ( empty)
values. =20
=20
Perhaps a change in code=20
=20
around line 3267
## For DB Nulls
if ( $access_comment[$i] ) {
$line =3D~ s/<<>>/$access_comment[$i]/g;
} else {
$line =3D~ s/<<>>/NULL/g;
fi
}
=20
=20
While this is just an example, I would think it would be good to
populate templates with NULL whenever a field may be "empty ( ie: any
empty comment field )
- - - Though I'm having a problem trying to get a " \N" to actually be
loaded as a "NULL"=20
=20
=20
or from: http://dev.mysql.com/doc/mysql/en/Problems_with_NULL.html
=20
When reading data with LOAD DATA INFILE, empty or missing columns are
updated with ''. If you want a NULL value in a column, you should use \N
in the data file. The literal word ``NULL'' may also be used under some
circumstances. See section 14.1.5 LOAD DATA INFILE Syntax
.=20
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html
the FIELDS ESCAPED BY character is empty, no characters are escaped and
NULL is output as NULL, not \N. It is probably not a good idea to
specify an empty escape character, particularly if field values in your
data contain any of the characters in the list just given.=20
For input, if the FIELDS ESCAPED BY character is not empty, occurrences
of that character are stripped and the following character is taken
literally as part of a field value. The exceptions are an escaped `0' or
`N' (for example, \0 or \N if the escape character is `\'). These
sequences are interpreted as ASCII NUL (a zero-valued byte) and NULL.
The rules for NULL handling are described later in this section.=20
( or something along these lines of confusion)
=20
=20
....=20
=20
=20
ITEM 2 =3D=3D=3D=3D=3D=3D=3D=3D
=20
COMMENTS that are entered with just a numerical value - DO NOT SHOW UP
when used with templates. It appears CP add's a "quote" to any
"character string" - but not a numerical value:
=20
Therefore IF you add a comment such as a tracking number ie: 2766 =20
It will not show up in your template output.
However, IF you added a comment such as : #2766 it will show up.
=20
=20
=20
Dan Wisniewski
SBC
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---