Howdy,
I'm just getting to grips with GT::SQL but was hoping for a little help with something....
I'm currently using a loop for something that I think I could get rid of with the following:
$db = $DB->table('Links');
$db->select_options("ORDER BY $order", "LIMIT $foo,$bar");
%links = $db->select( { ID => \@ids } )->fetchall_list;
However %links seems to be empty, even though looping through it like:
for (@ids) {
$link = $db->select( { ID => $_ } )->fetchrow_hashref;
print %$link;
}
...seems to work.
GT::Dumper just prints undef.
Any ideas?
Whilst I'm rambling, I believe you can do:
$db->select( { ID => 1 } )->fetchrow_hashref;
to select all cols right?
This also seems to work;
$db->select('*', { ID => 1 } )->fetchrow_hashref;
Is either way ok? (obviously the first way is better)
If you don't want WHERE can you just do:
$db->select->fetchall_list;
??
What does $db->select; return?
Thaaaanks. Sorry for rambling :)
OOpps....btw....how is fetchall_list returned? Is that a hash of hashes or something?
I'm just getting to grips with GT::SQL but was hoping for a little help with something....
I'm currently using a loop for something that I think I could get rid of with the following:
$db = $DB->table('Links');
$db->select_options("ORDER BY $order", "LIMIT $foo,$bar");
%links = $db->select( { ID => \@ids } )->fetchall_list;
However %links seems to be empty, even though looping through it like:
for (@ids) {
$link = $db->select( { ID => $_ } )->fetchrow_hashref;
print %$link;
}
...seems to work.
GT::Dumper just prints undef.
Any ideas?
Whilst I'm rambling, I believe you can do:
$db->select( { ID => 1 } )->fetchrow_hashref;
to select all cols right?
This also seems to work;
$db->select('*', { ID => 1 } )->fetchrow_hashref;
Is either way ok? (obviously the first way is better)
If you don't want WHERE can you just do:
$db->select->fetchall_list;
??
What does $db->select; return?
Thaaaanks. Sorry for rambling :)
OOpps....btw....how is fetchall_list returned? Is that a hash of hashes or something?