Re: quick retrieval help
[prev]
[thread]
[next]
[Date index for 2005/01/14]
Hello Alex,
Also you would consider:
sub foo {
my $class = shift;
my $sth_int_down = NAC::Interface->sql_down();
$sth_int_down->execute();
return NAC::Interface->sth_to_objects($sth_int_down);
}
or even
sub foo { NAC::Interface->search_down() }
then
@objs = foo; # returns array of objects;
or
$objs = foo; # returns Class::DBI::Iterator
You should take a look at perldoc Class::DBI
SIncerely,
Aleksandr
Hartmaier Alexander wrote:
> Hi!
>
> I have to fetch a lot of records from my db and want to use the way
> described ‘quick retrieval’.
>
> I added
>
> __PACKAGE__->add_constructor(down => '__IDENTIFIER__ IN (SELECT
> __IDENTIFIER__ FROM nacadm.view_down_interfaces)');
>
> to the object NAC::Interface.
>
> My code looks like this:
>
> my $sth_int_down = NAC::Interface->sql_down();
>
> $sth_int_down->execute();
>
> $hash = $sth_int_down->fetchall_hash();
>
> map NAC::Interface->construct($_), $sth_int_down->fetchall_hash;
>
> I don’t know how to use the last line (from the docs).
>
> Can someone show me an example?
>
> How can I iterate over the fetched objects?
>
> Thanks!
>
> With kind regards
>
> Alexander Hartmaier
>
> T-Systems Austria GesmbH
>
> Rennweg 97-99 1030 Wien
>
> phone: +43 57057-4320
>
> fax: +43 57057-95-4320
>
> mobile: +43 676 8642 4320
>
> mail: alexander.hartmaier@xxxxxxxxx.xx
>
> internet: http://www.t-systems.at <http://www.t-systems.at/>
>
>
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Hinweis: Dieses E-mail kann vertrauliche und geschützte Informationen
> enthalten.
> Sollten Sie nicht der beabsichtigte Empfänger sein, verständigen Sie
> bitte den Absender und löschen Sie dieses E-mail dann sofort.
>
> Notice: This e-mail contains information that is confidential and may
> be privileged.
> If you are not the intended recipient, please notify the sender and
> then delete this e-mail immediately.
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
|
|
Re: quick retrieval help
Aleksandr Guidrevitch 14:44 on 14 Jan 2005
|