John Scoles wrote:
I guess that counts as my first patch for DBD::ODBC lol

Want to go for a second one now then?

I don't need to do this but I'd like to. There are two C typedefs in two separate header files and I'd like to protect against a compilation where sizeof(type1) != sizeof(type2) - it's basically down to the fact that a WCHAR in Windows being a 2 byte quantity and in UNIX the ODBC driver managers can be built with WCHAR = 4 bytes or 2 bytes although by default they are built with a WCHAR being 2 bytes. I'd like to make sure you cannot build DBD::ODBC if sizeof(WCHAR) != 2 (because as it stands the unicode I have will only work with 2 byte WCHAR.) You cannot use sizeof in the C preprocessor as in:

#if (sizeof(WCHAR) != 2)

as far as I am aware. So the question becomes how can you test sizeof(WCHAR) = 2 before building DBD::ODBC?

Martin
----- Original Message ----- From: "Martin Evans" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, July 03, 2007 12:56 PM
Subject: Re: DBD test case conditional on compile option


Thanks John,

Good idea, have implemented it as a dbh read-only attribute.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

John Scoles wrote:
You might want to add a property to the package DBD::ODBC::db called can_unicode
set it during the Make process then read it in the test process??

We have a method like that in DBD::ORACLE

here is the stub (of course you know to change the ora_ )

sub ora_can_unicode {
my $dbh = shift;
my $refresh = shift;
# 0 = No Unicode support.
# 1 = National character set is Unicode-based.
# 2 = Database character set is Unicode-based.
# 3 = Both character sets are Unicode-based.

return $dbh->{ora_can_unicode}
    if defined $dbh->{ora_can_unicode} && !$refresh;

my $nls = $dbh->ora_nls_parameters($refresh);

$dbh->{ora_can_unicode}  = 0;
$dbh->{ora_can_unicode} += 1 if $nls->{NLS_NCHAR_CHARACTERSET} =~ /UTF/; $dbh->{ora_can_unicode} += 2 if $nls->{NLS_CHARACTERSET} =~ /UTF/;

return $dbh->{ora_can_unicode};
   }

----- Original Message ----- From: "Martin Evans" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, July 03, 2007 12:13 PM
Subject: DBD test case conditional on compile option


Hi,

I am modifying DBD::ODBC and a switch to perl Makefile.PL will cause DBD::ODBC to be built with a different compile macro (e.g. -DWITH_UNICODE). The problem is that some of the test cases are only relevant if DBD::ODBC is compiled with this option.

Originally, I was going to modify Makefile.PL to create a file called WITH_UNICODE and check for its existence in the test and skip the tests if not found. However, I don't know how to remove the file in the make clean rule of MakeMaker.

Any ideas how I can do this, or alternatives greatly appreciated.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com








Reply via email to