Author: turnstep
Date: Wed Jul 18 09:46:13 2007
New Revision: 9756

Modified:
   DBD-Pg/trunk/Changes
   DBD-Pg/trunk/dbdimp.c

Log:
Check for UTF8 inside of column names: fixes fetchrow_hashref among others.


Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes        (original)
+++ DBD-Pg/trunk/Changes        Wed Jul 18 09:46:13 2007
@@ -1,6 +1,7 @@
 ('GSM' is Greg Sabino Mullane, [EMAIL PROTECTED])
 
 1.50
+       - Force column names to respect utf8-ness. Per report from Ch Lamprect. 
[GSM]
        - Add support for asynchronous queries. [GSM]
        - Make minimum supported server 7.4. [GSM]
        - Add private_attribute_info() method. [GSM]

Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c       (original)
+++ DBD-Pg/trunk/dbdimp.c       Wed Jul 18 09:46:13 2007
@@ -881,9 +881,18 @@
 
                if (strEQ("NAME", key)) {
                        AV *av = newAV();
+                       char *fieldname;
+                       SV * sv_fieldname;
                        retsv = newRV(sv_2mortal((SV*)av));
                        while(--fields >= 0) {
-                               (void)av_store(av, fields, 
newSVpv(PQfname(imp_sth->result, fields),0));
+                               //fieldname = newSVpv(PQfname(imp_sth->result, 
fields),0);
+                               fieldname = PQfname(imp_sth->result, fields);
+                               sv_fieldname = newSVpv(fieldname,0);
+#ifdef is_utf8_string
+                               if (is_high_bit_set(fieldname) && 
is_utf8_string((unsigned char *)fieldname, strlen(fieldname)))
+                                       SvUTF8_on(sv_fieldname);
+#endif
+                               (void)av_store(av, fields, sv_fieldname);
                        }
                }
                else if (strEQ("TYPE", key)) {

Reply via email to