Jirka Novak wrote:
> Hi,
>
> I probably hit bug in DBD::ODBC when it is compiled with unicode support.
> I found that when I have table with NVARCHAR() column and try to write
> NULL (undef) value by placeholder, perl write 'Use of uninitialized
> value in subroutine entry at xxx.pl line xx.', where xxx.pl and xx are
> name of my code and line with execute().
> I tested it on MS Windows 2k, 2k3 and 2k8 with multiple versions of
> MS-SQL server and its ODBC driver. I used ActivePerl 5.10 with DBD::ODBC
> 1.16.
> Later I found that when I'm trying insert NULL to other types of
> column, no message is shown.
>
> Sample sequence:
> # table
> # CREATE TABLE test (
> # c1 NVARCHAR(100)
> # );
>
> # connect to db...
> # do prepare and execute
> $dbh=$db->prepare('INSERT INTO test VALUES (?)');
> $dbh->execute(undef); # Message is shown
>
> Then I searched for source of message and I found that problem is in
> dbdimp.c. Nonunicode branch checks if value is undef and handles it
> different way than defined values. Same code is missing on unicode branch.
> I tested attached patch with DBD::ODBC 1.20 and it works. I would like
> to report it as bug.
>
> May someone check patch and my finding before I will try to contribute
> patch to current version of DBD::ODBC?
>
> Yours,
>
> Jirka Novak
>
Thank you for finding this problem, diagnosing it and producing a patch.
As the current maintainer I can confirm your patch has got to the right
place. I will hopefully get around to looking at it properly later
today. You may, if you wish report an official bug on
http://rt.cpan.org/Public/Dist/Display.html?Name=DBD-ODBC but if you do
make sure it is marked 1.16 - 1.20 as this will remind me your patch is
against an older version than that in the subversion tree and released
(1.21).
If you are in a position to build a new DBD::ODBC when it is released
please let me know and I'll send you a copy you can test before it is
released properly.
Thanks again.
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com