Re: Question on FetchHashKeyName

"Jonas B. Nielsen" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Hi Nomad,

Thanks a lot.

This is what I need, but not what I am observing. I will do some more testing, with the FetchHashKeyName set to NAME against SQLite. Then I will try to redo the test against Oracle, I know DBD::Oracle defaults to uppercase, so I might not be able to skip my translation dictionary anyway if NAME is not supported and works as for DBD::SQLite

I reread the section on the docs (https://metacpan.org/pod/DBI#FetchHashKeyName), and now it makes sense.

IMHO that NAME preserves casing is not completely clear due to the focus on NAME_uc and NAME_lc and recommendation on their use.

Anyway thanks for the push in the right direction.

jonasbn

> On 28 Feb 2017, at 21:13, [email protected] wrote:
> 
> On Tue Feb 28, 2017 at 07:37:17PM +0100, Jonas B. Nielsen wrote:
>> 
>> - Would it be possible to have FetchHashKeyName preserve case? so if
>> a database was using camelCase this would be preserved.
> 
> A quick test seems to produce what you are looking for with the default
> setting of "NAME":
> 
>    #!/usr/bin/env perl
>    use strict;
>    use warnings;
>    use Data::Dumper;
>    use DBI;
> 
>    my $db  = DBI->connect('dbi:SQLite:db=:memory:');
>    my $sth = $db->prepare(q{SELECT 1 AS CamelCase});
>    $sth->execute;
> 
>    print Dumper( $sth->fetchrow_hashref );
> 
>    # Output is:
>    # $VAR1 = {
>    #          'CamelCase' => 1
>    #        };
> 
> What kind of behaviour were you expecting?
> 
> Mark
> --
> Mark Lawrence

—
pauseid: JONASBN
email: [email protected]
twitter: @jonasbn
blog: https://lastmover.wordpress.com/
signature.asc (application/pgp-signature, 842 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYtd0MAAoJELBdKQZWcKdtBwUP/ipnpBb1u6irToWRLwcAlq4u
GMgnjTxP9IICIzQhX8XT5UoDH0x3726tWpAD6g1KYGbjCFfAQcCgxmWmrOLZwh5i
FWHcU+s1woN/stugr2iREeU9Tax2QuM0o8jPj/q8OphOtZ/jqPTxeKFuq0Cny6Cz
icesCqVo4Ny935inej0qNk+7rOtIlUv/ezFbgsQ3kXtbgilYYfVKphJ2Yyvs46Vf
8X7+o4FygB67k5fdCo53axesZdhRK4e7y7EeHc6yEpo/oMP2XpvRkBtmDbtltsUi
cVDa+SN1FMLN9zORCTTWRhQmEAY9iDc82s+ElKGJJPsmfnjTuDLUZGR5LRl4Jdil
iR4vbIFfrIDpe6ExVnA1YBk4vIURkoSw5AIi7IYw8sXQAzlSNCHcXymeGWHxGmoF
i2JUDaL5aSavuvr/OKqS+mbmDqVTNuc88XL3IWsW62s48vTmaMN1M1r+53iY+T8O
TOJasTzHJEnNaxp5Gp7m9StnvqcH/EaZQtLXekmqQTVNsa7svuCqTEC58TS3eQdj
AHb1WM8WWrfSTrEikBuYQcoxSEfLLFEAgBdi6BgiKD1kbUyqcsmhM2uryisQVEZp
MxwYUdY9msSZQVhFAy2v7PCucOGThsLN0juTJgfL6w6WWhyeL5H7gN9VCCufQrY6
2ymx2MmfGxVYG3l1atbl
=Oa8b
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.