Re: quick retrieval help
[prev]
[thread]
[next]
[Date index for 2005/01/14]
Re!
It seems that Class::DBI is a typical Perl thing...you can do it with man=
y different ways.
I now use
@interfaces =3D NAC::Interface->search_down();
which is short than the 3 lines I had before.
@Aleks: Which part of perldoc Class::DBI do you mean? I already read the =
whole doc many times...
-Alex
-----Urspr=FCngliche Nachricht-----
Von: Aleksandr Guidrevitch [mailto:pillgrim@xxx.xx]=20
Gesendet: Freitag, 14. Januar 2005 15:45
An: Hartmaier Alexander; cdbi-talk@xxxxxx.xxxxx.xxx
Betreff: Re: quick retrieval help
Hello Alex,
Also you would consider:
sub foo {
my $class =3D shift;
my $sth_int_down =3D 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 =3D foo; # returns array of objects;
or
$objs =3D 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=20
> described 'quick retrieval'.
>
> I added
>
> __PACKAGE__->add_constructor(down =3D> '__IDENTIFIER__ IN (SELECT=20
> __IDENTIFIER__ FROM nacadm.view_down_interfaces)');
>
> to the object NAC::Interface.
>
> My code looks like this:
>
> my $sth_int_down =3D NAC::Interface->sql_down();
>
> $sth_int_down->execute();
>
> $hash =3D $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=FCtzte Informationen=
=20
> enthalten.
> Sollten Sie nicht der beabsichtigte Empf=E4nger sein, verst=E4ndigen Si=
e=20
> bitte den Absender und l=F6schen Sie dieses E-mail dann sofort.
>
> Notice: This e-mail contains information that is confidential and may=20=
> be privileged.
> If you are not the intended recipient, please notify the sender and=20
> then delete this e-mail immediately.
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*"*"*
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*"*
Hinweis: Dieses E-mail kann vertrauliche und gesch=FCtzte Informationen e=
nthalten.
Sollten Sie nicht der beabsichtigte Empf=E4nger sein, verst=E4ndigen Sie =
bitte den Absender und l=F6schen 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
Hartmaier Alexander 15:25 on 14 Jan 2005
|