For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2005 > using reference to the fetched rows









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author using reference to the fetched rows
Manish Sapariya

2005-04-22, 8:55 am

Hi list,
When using DBI module as,


my $return_list = $sth->fetchrow_arrayref;

Can I copy the reference to some other variable

say, e.g.

my $CopyOfResult = $return_list;

and do another query using the same handle and
use $CopyOfResult and $return_list?

My question is how does perl will release the
memory used to store the results?

Thanks,
Manish
Manish Sapariya

2005-04-22, 8:55 am

Should have read
perldoc DBI
========
Note that the same array reference is returned for each fetch, so
don't store the reference and then use it after a later fetch.
Also, the elements of the array are also reused for each row, so
take care if you want to take a reference to an element. See also
"bind_columns".
=============
Thanks anyways, :-)
-Manish


On 04/22/2005 11:27 AM, Manish Sapariya wrote:
> Hi list,
> When using DBI module as,
>
>
> my $return_list = $sth->fetchrow_arrayref;
>
> Can I copy the reference to some other variable
>
> say, e.g.
>
> my $CopyOfResult = $return_list;
>
> and do another query using the same handle and
> use $CopyOfResult and $return_list?
>
> My question is how does perl will release the
> memory used to store the results?
>
> Thanks,
> Manish

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com