Returning multiple MySQL rows from module
- From: iaccounts@xxxxxxxxxx (Steve Bertrand)
- Date: Tue, 27 Nov 2007 10:05:07 -0500
Hi all,
I am trying to modularize some standard MySQL queries that I frequently
do against our RADIUS DB.
The current setup feels very 'kludgy' to me. The code snip below comes
out of the module. I hope there is enough context to see why I think it
can be improved.
Essentially, I'd like a graceful way for the module to perform the
query, and then as neatly as possible pass back the result in a manner
that would require the minimal amount of processing when it's returned
back to the initial application. In almost all cases, there will be
multiple rows returned:
--- snip ---
$query->execute;
my @current_row;
my @total_rows;
while (@current_row = $query->fetchrow_array()) {
push (@total_rows, [@current_row]);
@current_row = ();
}
return (@total_rows);
--- end snip ---
Regards,
Steve
.
- Follow-Ups:
- Re: Returning multiple MySQL rows from module
- From: Tom Phoenix
- Re: Returning multiple MySQL rows from module
- Prev by Date: Custom pragmas
- Next by Date: Re: error on simple system command
- Previous by thread: Custom pragmas
- Next by thread: Re: Returning multiple MySQL rows from module
- Index(es):
Relevant Pages
|