Unexpected backslashes \\ in dbaccess unload output
Posted in 2004
Topics: Connectivity: ODBC / JDBC / .NET, Server Administration, Migration, Import/Export & Data Conversion
Is there a known issue with dbaccess unload commands rendering empty
or null text fields with a backslash and a space?
The output I am seeing is like this:
field 1|\\ |field3|
When I use JDBC to select the row or even do a select inside dbaccess
the empty field is not rendered with a backslash.
This issue only seems to occur with dbaccess running on unix (hp/ux),
not on Windows.
Any ideas?
TIA,
Mike.
"Michael Ben-David" <mikebd@iname.com> wrote in message news:d2e77b7f.0408091509.77a747b1@posting.google.com...
> Is there a known issue with dbaccess unload commands rendering empty
> or null text fields with a backslash and a space?
>
> The output I am seeing is like this:
> field 1|\\ |field3|
it means the data has blank spaces. Informix treats NULL and blank spaces
differently. You can check it as follows:-
select *
from ..
where length(trim(column name)) = 0 ;
It will show the above row or rows.
When the above data will be loaded, the backslash will indicate to dbaccess
that it is actually a space. The backslash itself will not be loaded.
>
> When I use JDBC to select the row or even do a select inside dbaccess
> the empty field is not rendered with a backslash.
>
> This issue only seems to occur with dbaccess running on unix (hp/ux),
> not on Windows.
>
> Any ideas?
>
> TIA,
> Mike.
"Michael Ben-David" <mikebd@iname.com> wrote in message news:d2e77b7f.0408091509.77a747b1@posting.google.com...
> Is there a known issue with dbaccess unload commands rendering empty
> or null text fields with a backslash and a space?
>
> The output I am seeing is like this:
> field 1|\\ |field3|
it means the data has blank spaces. Informix treats NULL and blank spaces
differently. You can check it as follows:-
select *
from ..
where length(trim(column name)) = 0 ;
It will show the above row or rows.
When the above data will be loaded, the backslash will indicate to dbaccess
that it is actually a space. The backslash itself will not be loaded.
>
> When I use JDBC to select the row or even do a select inside dbaccess
> the empty field is not rendered with a backslash.
>
> This issue only seems to occur with dbaccess running on unix (hp/ux),
> not on Windows.
>
> Any ideas?
>
> TIA,
> Mike.
rkusenet wrote:
> "Michael Ben-David" <mikebd@iname.com> wrote:
>>Is there a known issue with dbaccess unload commands rendering empty
>>or null text fields with a backslash and a space?
>>
>>The output I am seeing is like this:
>>field 1|\\ |field3|
>
>
> it means the data has blank spaces. Informix treats NULL and blank spaces
> differently. You can check it as follows:-
>
> select *
> from ..
> where length(trim(column name)) = 0 ;>
> It will show the above row or rows.
>
> When the above data will be loaded, the backslash will indicate to dbaccess
> that it is actually a space. The backslash itself will not be loaded.
>
>
>>When I use JDBC to select the row or even do a select inside dbaccess
>>the empty field is not rendered with a backslash.
>>
>>This issue only seems to occur with dbaccess running on unix (hp/ux),
>>not on Windows.
It's slightly more complex than that. It came up on one of the IUG
mailing lists recently, and I gave an answer there, too.
The backslash-space digraph only appears for zero-length non-null
VARCHAR, NVARCHAR or LVARCHAR fields. It is interpreted specially by
DB-Access. I'm in the process of fixing up SQLCMD so it handles them
too - because people are running into this (though the feature has
been around most of the current millenium, maybe longer).
What's the difference between a zero-length non-null value and a null
value?
On disk, a zero-length non-null VARCHAR uses 1 byte of storage, with
hex code 0x00, denoting zero length. A NULL VARCHAR uses 2 bytes of
storage, with hex code 0x01, denoting length of one byte, and 0x00,
the ASCII NUL character, denoting NULL.
At the (ESQL/C) code level, you can tell the difference only by
looking at the indicator variable.
Anywhere other than the only two characters in a xVARCHAR field,
backslash space is equivalent to space.
You can find out about the Informix LOAD format from the file
unload.format in the SQLCMD source code available at the IIUG software
archive.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/