[moved to dbi-dev]

On Thu, Mar 18, 2004 at 07:28:05PM -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.
> 
> Yes, that's a good idea - I'll move the database character set tests up into
> the module and expose it a method as you suggest.
> 
> I wonder if there needs to be another value; in 8i I believe you can have
> the database character set as Unicode but the national character set as
> 8-bit (I'll test this if I get a chance at the weekend). My initial
> impression of the meaning of '2' would be that it implies that both the
> national and default characters sets can support Unicode - which would only
> be true from 9i onwards, as per your comment, where you're forced to use a
> Unicode-based character set for the national character set.
> 
> So perhaps:
> 
> 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.

So it's effectively a two bit field, sure.

> And with a couple of constants for readability (not sure about the names
> here, these are just examples) you can do something like:
> 
> if ($dbh->ora_can_unicode)
>     print 'There is some level of Unicode support in this server';
> if ($dbh->ora_can_unicode & ORA_UNICODE_CHARSET)
>     print 'Database character set supports Unicode';
> if ($dbh->ora_can_unicode & ORA_UNICODE_NATIONAL_CHARSET)
>     print 'Database national character set supports Unicode';
> if ($dbh->ora_can_unicode &
> ORA_UNICODE_CHARSET|ORA_UNICODE_NATIONAL_CHARSET)
>     print 'Both database character sets support Unicode';
> 
> What do you think?

I think the constants would be overkill, especially given the
relatively short life overwhich this will be useful.

Please use subversion as the development source has moved on a fair bit,
especially in the area of character sets and 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.

Thanks!

Tim.

Reply via email to