dbTalk Databases Forums  

fetchrow_hashref and field name case-sensitivity

mailing.database.msql-mysql-modules mailing.database.msql-mysql-modules


Discuss fetchrow_hashref and field name case-sensitivity in the mailing.database.msql-mysql-modules forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
zzapper
 
Posts: n/a

Default fetchrow_hashref and field name case-sensitivity - 07-01-2004 , 04:20 AM






Hi,
Mysql field names are case insensitive, but fetchrow_hashref requires you to use the exact field
case. I guess I could resolve this by looping thru the hash

for $key (keys %hashref)
{
$val =$hashref{$key};

$newhash{lc $key}=$val;

}

But what other options do I have?

(SORRY I realise this question must have a high Chestnut count for this NG)

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
David Dick
 
Posts: n/a

Default Re: fetchrow_hashref and field name case-sensitivity - 07-01-2004 , 05:15 AM






Try searching for 'FetchHashKeyName' => 'NAME_lc' in the DBI docs.

uru Dave

zzapper wrote:
Quote:
Hi,
Mysql field names are case insensitive, but fetchrow_hashref requires you to use the exact field
case. I guess I could resolve this by looping thru the hash

for $key (keys %hashref)
{
$val =$hashref{$key};

$newhash{lc $key}=$val;

}

But what other options do I have?

(SORRY I realise this question must have a high Chestnut count for this NG)

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
zzapper
 
Posts: n/a

Default Re: fetchrow_hashref and field name case-sensitivity - 07-01-2004 , 06:23 AM



On Thu, 01 Jul 2004 20:06:24 +1000, wrote:

Quote:
Try searching for 'FetchHashKeyName' => 'NAME_lc' in the DBI docs.

uru Dave
David

Thanx, exactly what I needed

while (my $hash_ref=$sel->fetchrow_hashref('NAME_lc'))
{

$postcode=$hash_ref->{'txtdevpostcode'};
$barrattid=$hash_ref->{'txtbarrattid'};
}


zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.