DBI and DBD::mysql pseudohash results set?

DBI and DBD::mysql pseudohash results set?

am 18.09.2004 13:02:18 von Dan Bolser

Hi,

I was thinking about loading the rows of a $sth results set into a
pseudohash so that the columns could be accessed by either the column name
or the column index.

This functionality is supported by a pseudohash

Snipet from http://perlmonks.thepen.com/19636.html

$struct = [{foo => 1, bar => 2}, "FOO", "BAR"];
$struct->{foo}; # same as $struct->[1], i.e. "FOO"
$struct->{bar}; # same as $struct->[2], i.e. "BAR"

__END__

However, I heard that the way pseudohashes work may change, and
pseudohash code may become obsolete or broken.

Snipet from
http://www.perl.com/pub/a/2001/05/p5pdigest/THISWEEK-2001052 0.html

Michael Schwern asked that pseudo-hashes should be removed from Perl 5.8
and onwards.

__END__

Is the above style of lookup already handled by DBI? You can do it in PHP.

Any feedback would be welcome,

All the best,
Dan.


--
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: DBI and DBD::mysql pseudohash results set?

am 18.09.2004 13:08:00 von Jochen Wiedmann

Dan Bolser wrote:

>I was thinking about loading the rows of a $sth results set into a
>pseudohash so that the columns could be accessed by either the column name
>or the column index.
>
>
You are of course free to do so. But what is it good for? DBI already
offers one or the other, on your choice, and I cannot remember a case
where I need both at the same time. Besides, you always have the DBI
metadata methods.


Jochen


--
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: DBI and DBD::mysql pseudohash results set?

am 18.09.2004 13:08:00 von Jochen Wiedmann

Dan Bolser wrote:

>I was thinking about loading the rows of a $sth results set into a
>pseudohash so that the columns could be accessed by either the column name
>or the column index.
>
>
You are of course free to do so. But what is it good for? DBI already
offers one or the other, on your choice, and I cannot remember a case
where I need both at the same time. Besides, you always have the DBI
metadata methods.


Jochen


--
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: DBI and DBD::mysql pseudohash results set?

am 18.09.2004 13:40:35 von Dan Bolser

On Sat, 18 Sep 2004, Jochen Wiedmann wrote:

>Dan Bolser wrote:
>
>>I was thinking about loading the rows of a $sth results set into a
>>pseudohash so that the columns could be accessed by either the column name
>>or the column index.
>>
>>
>You are of course free to do so. But what is it good for? DBI already
>offers one or the other, on your choice, and I cannot remember a case
>where I need both at the same time. Besides, you always have the DBI
>metadata methods.


You are right, it should never be strictly necessary. However, I am
thinking about a convenience function such as 'doQuery' (exported by my
MySQL::Simple perl module).

In general (I think) it is convenient to only remember one function call
'doQuery', and have a very flexible results set returned.

In this way the user can hack together an sql report in a very short
amount of time.

I will have to look into the metadata methods, as I am totally ignorant of
this feature.

Thanks for your help.

Anybody know about the future stability of the pseudohash?

Cheers,
Dan.


>
>
>Jochen
>
>
>


--
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: DBI and DBD::mysql pseudohash results set?

am 18.09.2004 13:40:35 von Dan Bolser

On Sat, 18 Sep 2004, Jochen Wiedmann wrote:

>Dan Bolser wrote:
>
>>I was thinking about loading the rows of a $sth results set into a
>>pseudohash so that the columns could be accessed by either the column name
>>or the column index.
>>
>>
>You are of course free to do so. But what is it good for? DBI already
>offers one or the other, on your choice, and I cannot remember a case
>where I need both at the same time. Besides, you always have the DBI
>metadata methods.


You are right, it should never be strictly necessary. However, I am
thinking about a convenience function such as 'doQuery' (exported by my
MySQL::Simple perl module).

In general (I think) it is convenient to only remember one function call
'doQuery', and have a very flexible results set returned.

In this way the user can hack together an sql report in a very short
amount of time.

I will have to look into the metadata methods, as I am totally ignorant of
this feature.

Thanks for your help.

Anybody know about the future stability of the pseudohash?

Cheers,
Dan.


>
>
>Jochen
>
>
>


--
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: DBI and DBD::mysql pseudohash results set?

am 21.09.2004 23:44:22 von Dan Bolser

On Sat, 18 Sep 2004, Dan Bolser wrote:

>On Sat, 18 Sep 2004, Jochen Wiedmann wrote:
>
>>Dan Bolser wrote:
>>
>>>I was thinking about loading the rows of a $sth results set into a
>>>pseudohash so that the columns could be accessed by either the column name
>>>or the column index.
>>>
>>>
>>You are of course free to do so. But what is it good for? DBI already
>>offers one or the other, on your choice, and I cannot remember a case
>>where I need both at the same time. Besides, you always have the DBI
>>metadata methods.
>
>
>You are right, it should never be strictly necessary. However, I am
>thinking about a convenience function such as 'doQuery' (exported by my
>MySQL::Simple perl module).
>
>In general (I think) it is convenient to only remember one function call
>'doQuery', and have a very flexible results set returned.
>
>In this way the user can hack together an sql report in a very short
>amount of time.
>
>I will have to look into the metadata methods, as I am totally ignorant of
>this feature.

Doh! Not thinking that day.


>
>Thanks for your help.
>
>Anybody know about the future stability of the pseudohash?
>
>Cheers,
>Dan.
>
>
>>
>>
>>Jochen
>>
>>
>>
>
>


--
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: DBI and DBD::mysql pseudohash results set?

am 21.09.2004 23:44:22 von Dan Bolser

On Sat, 18 Sep 2004, Dan Bolser wrote:

>On Sat, 18 Sep 2004, Jochen Wiedmann wrote:
>
>>Dan Bolser wrote:
>>
>>>I was thinking about loading the rows of a $sth results set into a
>>>pseudohash so that the columns could be accessed by either the column name
>>>or the column index.
>>>
>>>
>>You are of course free to do so. But what is it good for? DBI already
>>offers one or the other, on your choice, and I cannot remember a case
>>where I need both at the same time. Besides, you always have the DBI
>>metadata methods.
>
>
>You are right, it should never be strictly necessary. However, I am
>thinking about a convenience function such as 'doQuery' (exported by my
>MySQL::Simple perl module).
>
>In general (I think) it is convenient to only remember one function call
>'doQuery', and have a very flexible results set returned.
>
>In this way the user can hack together an sql report in a very short
>amount of time.
>
>I will have to look into the metadata methods, as I am totally ignorant of
>this feature.

Doh! Not thinking that day.


>
>Thanks for your help.
>
>Anybody know about the future stability of the pseudohash?
>
>Cheers,
>Dan.
>
>
>>
>>
>>Jochen
>>
>>
>>
>
>


--
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