Odbc module types returned etc 
Author Message
 Odbc module types returned etc

I'm generating web pages with a perl script which uses the
odbc module. The script accesses an Informix database
on a Unix box and provides me with the items I need to fill
out the web page.
All is well except for one small difficulty I can't resolve.
I have a field which id defined as a char length of 1 in the database.
The label for the field on its return from the FetchRow and
the DataHash processing is
$data{"h_idind"} and I'm attempting to test the field for  
the presence of the value "X".
If an X is present, I want the legend
"IRS Badge Required" to appear on the web page.
Don't run away!! It's just a list of hotels that IRS
employees are authorized to use while in travel status.
My problem is in evvery string test I'm aware of, I get incorrect results.
In records I've previously verified as containing a value of "X" in
that field, I've used the following tests.

if ($data{"h_idind"} eq "X"){
print ("IRS Badge Required <br>");

Quote:
}

In trying this, I get nothing even though there is indeed an X in that
field.
I've also used the cmp operator instead of eq with the same result.
Is the value returned from the fetchrow/DataHash processing in fact a scalar
or am I dealing
with something else?
Oh yes, I've also tried the =~ construct and
unless I have the syntax or the purpose of this one wrong, I'm getting the
same result.
Hopefully, I've revealed enough of my idiocy.
Thanks for any help,
Brad Trainham


Tue, 06 Nov 2001 03:00:00 GMT  
 Odbc module types returned etc
On Fri, 21 May 1999 09:41:00 -0500, Trainham Bradford

Quote:

>I'm generating web pages with a perl script which uses the
>odbc module. The script accesses an Informix database
>on a Unix box and provides me with the items I need to fill
>out the web page.
>All is well except for one small difficulty I can't resolve.
>I have a field which id defined as a char length of 1 in the database.
>The label for the field on its return from the FetchRow and
>the DataHash processing is
>$data{"h_idind"} and I'm attempting to test the field for  
>the presence of the value "X".
>If an X is present, I want the legend
>"IRS Badge Required" to appear on the web page.
>Don't run away!! It's just a list of hotels that IRS
>employees are authorized to use while in travel status.
>My problem is in evvery string test I'm aware of, I get incorrect results.
>In records I've previously verified as containing a value of "X" in
>that field, I've used the following tests.

>if ($data{"h_idind"} eq "X"){
>print ("IRS Badge Required <br>");
>}

if (chomp($data{"h_idind"}) eq "X")

You're likely getting bitten by  \r\n invisible characters..



Sat, 10 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. GIF Control Blocks / Types in perl - unsigned, etc.

2. Unable to compile DBD:ODBC module with Openlink ODBC Drivers

3. Windows NT and Perl (ODBC/Event/Registry/etc)

4. Problems with Oracle LONG RAW type/ODBC and Perl

5. DBD::ODBC truncates Memo type Access field

6. Determining data types using Win32::ODBC

7. DBI::ODBC, Win32 Access97 and Data Types

8. possible type at C:\Perl\lib\Win32\ODBC.pm

9. ODBC, DBI Column Types Won't Bind?

10. UNIX, MS-DOS, Macintosh, etc return character?

11. Subroutines:: Return Type Vs Performance

 

 
Powered by phpBB® Forum Software