develooper Front page | perl.dbd.pg | Postings from July 2011

Re: [DBD::Pg 2/2] Commit UTF-8 design notes/discussion betweenDWC/GSM

Thread Previous | Thread Next
From:
dhudes
Date:
July 22, 2011 00:02
Subject:
Re: [DBD::Pg 2/2] Commit UTF-8 design notes/discussion betweenDWC/GSM
Message ID:
231495349-1311293194-cardhu_decombobulator_blackberry.rim.net-885569504-@b5.c7.bise6.blackberry
I point out that Pg itself supports Perl for stored procedures in PL/Perl.
What if I have a perl program which wants to store a perl procedure to the database? I have not done such a thing myself I use stored procedures very seldom but I could see interesting possibilities
Sent from my BlackBerry® smartphone with Nextel Direct Connect

-----Original Message-----
From: "David E. Wheeler" <david@kineticode.com>
Date: Thu, 21 Jul 2011 16:54:25 
To: David Christensen<david@endpoint.com>
Cc: Greg Sabino Mullane<greg@turnstep.com>; <dbd-pg@perl.org>
Subject: Re: [DBD::Pg 2/2] Commit UTF-8 design notes/discussion between
 DWC/GSM

On Jul 21, 2011, at 4:23 PM, David Christensen wrote:

>> I disagree. It's me telling DBD::Pg what encoding the database uses, but I definitely want that converted to Perl's internal form. I *only* want raw if I explicitly ask for raw (or if there's no choice, such as when I set the encoding to ":raw" or something).
> 
> As a developer, why would you care if this information is available from the database itself?  If you are caring about the encoding at all, you would be dealing with bytes/octets.  Perl does not store unicode characters in any format besides UTF-8 so you're not changing "internal" characteristics ; what DBD::Pg uses to talk to your database shouldn't matter.

Because otherwise what's the point? I could just turn pg_unicode off.

>> I think of it being kind of like the `encdoding` pragma, in which I declare the encoding of my source code. Perl sees that and converts it to its internal form.
> 
> The only time this would be useful would be if your database is set to something inscrutable (aka SQL_ASCII); if your end result is meant to be internal perl, you have no business providing an encoding.

You are convincing me now that pg_encoding may not be useful at all, then.

>> I wonder if, as an interrime measure, existing code that sets pg_enable_utf8 should still do something, like set pg_encoding to "utf-8" and turn pg_unicode on.
> 
> Yeah, I'd had that thought, along with spitting the deprecation warning.

Right, I think that'd be the least painful thing for users.

> Yeah, it'd be nice to know what at least some proposed interfaces/APIs are so we don't need to support a whole other place setting for years to come.

+1

Best,

David


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About