Well spotted Tom! Thanks. Applied.
Tim.
On Thu, Apr 03, 2003 at 11:58:14AM -0700, Tom Malaher wrote:
> Very minor...
>
> In ph_type.t on line 127: ok(0, !defined $tmp->{es}->{c});
>
> A test is made to make sure that an empty string inserted into
> a CHAR column comes back as null (undef).
>
> However, at line 97:
> $tmp = $dbh->selectall_hashref(qq{
> SELECT name, vc, length(vc) as len, nvl(vc,'ISNULL') as isnull
> FROM $table
> }, "name");
>
> The select statement does not actually request that the CHAR column "C" be
> returned. So, of course it's *always* going to be undef, since it's not
> present in the hashref returned by the selectall_hashref, so the test
> would always succeed, even if the colunm in the DB is not null.
>
> For reference, the table definition is:
> CREATE TABLE $table (name VARCHAR2(2), vc VARCHAR2(20), c CHAR(20))
>
> So the proposed fix would be:
>
> *** ph_type.t Thu Apr 3 11:53:23 2003
> --- ph_type.t.fix Thu Apr 3 11:53:42 2003
> ***************
> *** 95,101 ****
>
> $dbh->trace($test_info->{ts}) if $test_info->{ts};
> $tmp = $dbh->selectall_hashref(qq{
> ! SELECT name, vc, length(vc) as len, nvl(vc,'ISNULL') as isnull
> FROM $table
> }, "name");
> ok(0, keys(%$tmp) == 3);
> --- 95,101 ----
>
> $dbh->trace($test_info->{ts}) if $test_info->{ts};
> $tmp = $dbh->selectall_hashref(qq{
> ! SELECT name, vc, length(vc) as len, nvl(vc,'ISNULL') as isnull, c
> FROM $table
> }, "name");
> ok(0, keys(%$tmp) == 3);
>
> ---
> Tom