Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 55772
Status: stalled
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: mrjobson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Add the support for hstore type introduced in new postgres
This is my temporary solution to reliably read/write hstore data type. At least i don't have problems with utf8 :) Thank you very much!
Subject: hstore.pl
use Test::More; sub pack_hstore { my $h = shift; my $r = ''; while (my ($k,$v) = each %$h) { $h->{$k} = '' if(!defined $v); # for test... $k = uri_escape_utf8($k); $v = uri_escape_utf8($v); $r.="\"$k\" => \"$v\","; } if(!eq_hash(unpack_hstore($r), $h)){ use Test::Deep; die cmp_deeply(unpack_hstore($r), $h,"packed hstore does not match unpacked"); }; return $r; } sub unpack_hstore { my $ho = shift; $ho = '' if !defined $ho; my $h = $ho; my $r = eval("{$h}"); if($@) { die $@; } my %res; while (my ($k,$v) = each %$r) { $k = uri_unescape($k); $v = uri_unescape($v); utf8::decode($k); utf8::decode($v); $res{$k} = $v; } return \%res || {}; }
From: mrjobson [...] gmail.com
!!!!!!!!!! >>>>>>>>>>>>>>> I've forgot to include headers into the file: use URI::Escape qw(uri_escape_utf8 uri_unescape); use utf8;
Subject: Re: [rt.cpan.org #55772] Add the support for hstore type introduced in new postgres
Date: Mon, 22 Mar 2010 23:06:40 -0400
To: bug-DBD-Pg [...] rt.cpan.org
From: "David E. Wheeler" <david [...] kineticode.com>
What's with all the URI escaping stuff? And if you have pg_enable_utf8 set, you shouldn't have to encode and decode the UTF-8. Oh, wait, maybe you do, to because pg_enable_utf8 is a bit too strict (see RT #40199). But still, what's with the URI escaping? Best, David