Re: PostgreSQL driver DBD::Pg releases version 3.0.0

2014-02-06 Thread Tim Bunce
On Thu, Feb 06, 2014 at 12:30:15PM +1100, Ron Savage wrote:

 Eg: map{($_ = encode('utf-8', $$hashref{$_}) )} keys %$hashref
 $$item{$_} = decode('utf-8', $$item{$_} || '') for keys %$item

Performance tip: using the function form of encode() and decode()
is significantly slower than using the method call form:

$utf8_encoding-decode($$item{$_} || ''):

 And each module tested under V 3.0.0 broke.
 
 But a 1-line change fixes them:
 
 $$attr{pg_enable_utf8}= 0 if ($$config{dsn} =~ /dbi:Pg/i);

Sweet.

 Gotta love utf8.

:)

Tim.


Re: DBI doc buglet

2014-02-06 Thread Ron Savage

Hi Tim

On 06/02/14 23:53, Tim Bunce wrote:

On Thu, Feb 06, 2014 at 02:22:35PM +1100, Ron Savage wrote:

Hi

Under connect(), 9 lines down, the text '(i.e., the $data_source prefix
is dbi::)' should only have 1 colon.


You mean here?:
https://github.com/perl5-dbi/dbi/blob/3b5b5a5f3ab4797f3e85d2f0ee244897ad47377a/DBI.pm#L2675


Correct.


 If just the driver_name part is empty (i.e., the $data_source prefix
 is dbi::), the environment variable DBI_DRIVER is used.

I think it's correct as-is. There's no driver_name between the two colons.


Ahh. My mistake of course.

--
Ron Savage
http://savage.net.au/


Re: PostgreSQL driver DBD::Pg releases version 3.0.0

2014-02-06 Thread Ron Savage

Hi Tim

On 06/02/14 23:48, Tim Bunce wrote:

On Thu, Feb 06, 2014 at 12:30:15PM +1100, Ron Savage wrote:


Eg: map{($_ = encode('utf-8', $$hashref{$_}) )} keys %$hashref
$$item{$_} = decode('utf-8', $$item{$_} || '') for keys %$item


Performance tip: using the function form of encode() and decode()
is significantly slower than using the method call form:

 $utf8_encoding-decode($$item{$_} || ''):


So, first call my($utf8_encoding) = find_encoding('utf-8'), eh?

$many x $thanx;


And each module tested under V 3.0.0 broke.

But a 1-line change fixes them:

$$attr{pg_enable_utf8}= 0 if ($$config{dsn} =~ /dbi:Pg/i);


Sweet.


Gotta love utf8.


:)

Tim.



--
Ron Savage
http://savage.net.au/