fetchrow_hashref and field name case-sensitivity

fetchrow_hashref and field name case-sensitivity

am 01.07.2004 11:09:13 von zzapper

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=gcdmp-msql-mysql-modules@m .gmane.org

Re: fetchrow_hashref and field name case-sensitivity

am 01.07.2004 12:06:24 von David Dick

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

uru Dave

zzapper wrote:
> 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=gcdmp-msql-mysql-modules@m .gmane.org

Re: fetchrow_hashref and field name case-sensitivity

am 01.07.2004 12:06:24 von David Dick

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

uru Dave

zzapper wrote:
> 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=gcdmp-msql-mysql-modules@m .gmane.org

Re: fetchrow_hashref and field name case-sensitivity

am 01.07.2004 13:23:33 von zzapper

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

>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=gcdmp-msql-mysql-modules@m .gmane.org

Re: fetchrow_hashref and field name case-sensitivity

am 01.07.2004 13:23:33 von zzapper

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

>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=gcdmp-msql-mysql-modules@m .gmane.org