Re: quick retrieval help

[prev] [thread] [next] [Date index for 2005/01/14]

From: Aleksandr Guidrevitch
Subject: Re: quick retrieval help
Date: 14:44 on 14 Jan 2005
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.
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*


quick retrieval help
Hartmaier Alexander 15:27 on 13 Jan 2005

Re: quick retrieval help
Aleksandr Guidrevitch 18:47 on 13 Jan 2005

Re: quick retrieval help
Hartmaier Alexander 07:23 on 14 Jan 2005

Re: quick retrieval help
Aleksandr Guidrevitch 07:51 on 14 Jan 2005

Re: quick retrieval help
Peter Speltz 08:06 on 14 Jan 2005

Re: quick retrieval help
Tony Bowden 10:06 on 14 Jan 2005

Re: quick retrieval help
Peter Speltz 17:04 on 14 Jan 2005

Re: quick retrieval help
Aleksandr Guidrevitch 14:44 on 14 Jan 2005

Re: quick retrieval help
Hartmaier Alexander 15:25 on 14 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52