Normally i use something like:
my $links_db=$DB->table ('Links', 'CatLinks', 'Category');
my $cond = GT::SQL::Condition->new(
'isValidated' => '=' => 'Yes',
'something' => '=' => '5',
);
$links_db->select_options ("GROUP BY Links.ID ORDER BY Mod_Date DESC", "LIMIT 30");
my $sth2 = $links_db->select( ['Links.ID','Title','URL'] => $cond );
while (my ($id,$title,$url) = $sth2->fetchrow_array) {
...
}
But for now i would like to have everything in an array.
So i can do:
...
while (my ($ar[ID],$ar[Title],ar) = $sth2->fetchrow_array) {[/code]
But i would like to have something like:
[code]my @ar;
...
while (my ($ar[]) = $sth2->fetchrow_array) {[/code]
Is this possible?
Or is there another way to have an array back without write every field in the code?
I have a lot of fields and i have a lot of selects. Because of this i try to write a sub and pass all the values to this sub.
I would like to have something like:
[code]
select * from ...
while $array = fields {
call sub ($array)
}
[/code]
With this i would save one million lines of code in my build.pm :)
Code:
my $links_db=$DB->table ('Links', 'CatLinks', 'Category');
my $cond = GT::SQL::Condition->new(
'isValidated' => '=' => 'Yes',
'something' => '=' => '5',
);
$links_db->select_options ("GROUP BY Links.ID ORDER BY Mod_Date DESC", "LIMIT 30");
my $sth2 = $links_db->select( ['Links.ID','Title','URL'] => $cond );
while (my ($id,$title,$url) = $sth2->fetchrow_array) {
...
}
But for now i would like to have everything in an array.
So i can do:
Code:
my @ar; ...
while (my ($ar[ID],$ar[Title],ar) = $sth2->fetchrow_array) {[/code]
But i would like to have something like:
[code]my @ar;
...
while (my ($ar[]) = $sth2->fetchrow_array) {[/code]
Is this possible?
Or is there another way to have an array back without write every field in the code?
I have a lot of fields and i have a lot of selects. Because of this i try to write a sub and pass all the values to this sub.
I would like to have something like:
[code]
select * from ...
while $array = fields {
call sub ($array)
}
[/code]
With this i would save one million lines of code in my build.pm :)