Re: how to allow variable number of argumets in mysql insert query
"Wagner, Chris (GEAE, CBTS)" <[email protected]> Wed, 19 Dec 2007 08:23:36 -0500
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Organization | GE Aircraft Engines \Cincinnati Bell |
| Message-ID | <[email protected]> |
Heh, that way may work, but it's horrid. :P My way does call execute
with a list value and MySQL nor Perl doesn't complain. I forgot to
mention that $fieldref should be a sorted list of the keys.
prepare_cached() needs the same order every time or it thinks it's a new
call.
fungazid wrote:
>
> Thanks Chris,
>
> Using prepare_cached() is a good idea,
> Does your function calls execute() with an array ? (I think mysql will
> complain)
> I found a simple that works perfectly for me, which is to use eval() !
>
> $str='$args[1],$args[2],$args[3],$args[4],$args[5],';
> my $str2='$q->execute('.$str.') or die "Couldn\'t execute statement: " .
> $q->errstr';
> eval $str2 or die "error!!!\n";
--
Chris Wagner
CBTS
GE Aircraft Engines
[email protected]
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]