On Fri, Mar 19, 2004 at 03:11:18PM -0000, Andy Hassall wrote:
> >>> It would be handy to have a function that, given a $dbh,
> >>> returns 1 if the
> >>> database national char set supports unicode (which would be
> >>> true for Oracle >=9)
> >>> and 2 if the database default charset is unicode.
> >>>
> >>> Could even live in the driver as an $dbh->ora_can_unicode; method.
>
> >> 0 = Neither character set is Unicode.
> >> 1 = National character set is Unicode.
> >> 2 = Database character set is Unicode.
> >> 3 = Both national and database character sets are Unicode.
> >
> > And please,
> > just for now, stick to adding $dbh->ora_can_unicode so as not to tread
> > on Jeff Urlwin and Lincoln Baxter's toes, as they're working with
> > me on utf8 support.
>
> Attached is the patch for adding ora_can_unicode.
Thanks. Is the /UTF/ regex safe against false matches?
+ $dbh->{ora_can_unicode} += 1 if ($national_charset =~ /UTF/);
+ $dbh->{ora_can_unicode} += 2 if ($database_charset =~ /UTF/);
I was about to apply it when I started wondering if it could be one
with one db query instead of two. Then I started wondering if it
might be better to add a ora_nls_parameters() method using:
$dbh->{ora_nls_parameters} = $dbh->selectall_hashref(q{
SELECT parameter, value FROM v$nls_parameters
});
and then implement ora_can_unicode() in terms of $dbh->{ora_nls_parameters}
If that sounds good to you could you rework it that way?
See also the install_method() calls in DBD::Oracle::driver().
Tim.