RE: Where are the selected rows stored using fetchall_arrayref




Thanks Mark and Steve B. for your comments. I will make the changes to
the program. Excellent advise.

Peter Loo
Wolters Kluwer Health
(602) 381-9553

-----Original Message-----
From: markd [mailto:mark@xxxxxxxxxxxxx]
Sent: Monday, May 22, 2006 6:24 PM
To: Loo, Peter # PHX
Cc: dbi-users@xxxxxxxx
Subject: Re: Where are the selected rows stored using fetchall_arrayref

There is nothing to be gained here by using fetchall_arrayref, and you
will almost certainly have problems. You want to actually do:

while ($row = $sth->fetchrow_arrayref()) {
$sock->send(join($delim, @$row));
}

Mark

Loo, Peter # PHX wrote:
Hi,

I was wondering if someone can tell me how, where and what Perl DBI
stores the data returned from fetchall_arrayref. For example: if I
issues a SELECT statement such as "select a.col1, b.col2, c.col3 from
someTable1 a, someTable2 b, someTable3 c where someCondition". From
this I get an array reference. I understand that the array references

are pointers, but where are these pointers stored.

I will be using Perl DBI to dump approximately five billion rows
through a socket to another server where another program will bulk
load to a database server.

Here is an example of what I am going to be doing:


unless ($arrayref = $sth->fetchall_arrayref()) {
$MESSAGE = "sub_fetchallArrayref() - $DBI::errstr";
$STATUS = $FAILURE;
sub_exit();
}

my $sock = new IO::Socket::INET->new(PeerPort => $port, Proto =>
$proto, PeerAddr => $node);
if (!$sock) {
print STDERR "Unable to open socket to $node at port $port using

protocol $proto.\n";
return $FAILURE;
}

foreach $row (@{$arrayref}) {
$piped = join($delim, @$row);
$sock->send($piped) || return $FAILURE;
}

My concern is I might run out of memory. Hope someone can shed some
light.

Thanks in advance.

Peter


This E-mail message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please contact the sender by reply
E-mail, and destroy all copies of the original message.



This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message.
.



Relevant Pages

  • RE: sth->do()
    ... Peter Loo ... Loo, Peter # PHX wrote: ... This E-mail message is for the sole use of the intended recipientand ...
    (perl.dbi.users)
  • SUMMARY: Off topic: legato mail list
    ... This e-mail message is for the sole use of the intended recipientand ... may contain proprietary, confidential and/or privileged information. ... unauthorized review, use, disclosure or distribution is prohibited. ... deliver it to the intended recipient), you may not copy or deliver this ...
    (SunManagers)
  • Re: AIX 5.3 disaster recovery fro AIX newbie
    ... fro AIX newbie ... errors or omissions in this e-mail message. ... not the intended recipient or the individual responsible for delivering ... e-mail do not reflect the views of Blue Cross Blue Shield of Florida, ...
    (AIX-L)
  • RE: DBI->data_sources(Oracle)
    ... As far as I understand DBD::Oracle, ... This E-mail message is for the sole use of the intended recipient ... you are not the intended recipient, please contact the sender by reply ...
    (perl.dbi.users)
  • Re: AIX 5.3 disaster recovery fro AIX newbie
    ... Can I get into maint mode from hard drive or I will need an alternate ... omissions in this e-mail message. ... e-mail do not reflect the views of Blue Cross Blue Shield of Florida, ... intended recipient or the individual responsible for delivering to the ...
    (AIX-L)