how to allow variable number of argumets in mysql insert query
fungazid <[email protected]> Tue, 18 Dec 2007 07:56:35 -0800 (PST)
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Help help help please
Iām using DBD::mysql, where Insert query looks like:
______________________________________________________________
my $str= ā?,?,?,,,ā;
$q=$dbh->prepare("INSERT INTO $table VALUES($str)")
or die "Couldn't prepare statement: " . $dbh->errstr;
$q->execute($args1[0],$args1[1],$args1[2],ā¦)
or die "Couldn't execute statement: " . $q->errstr;
________________________________________________________________
THE PROBLEM:
If I want to change the number of arguments sent to execute(), I must change
the source code.
I would like to be able to change it on run-time with something like:
______________________________________________________________
$q->execute(f(@args1))
or die "Couldn't execute statement: " . $q->errstr;
_____________________________________________________________
where f() formats the input to the function, and @args1 is allowed to have a
variable size.
This may add invaluable flexibility to my program, but how to do it ????.
thanks for your advices
A
--
View this message in context: http://www.nabble.com/how-to-allow-variable-number-of-argumets-in-mysql-insert-query-tp14399793p14399793.html
Sent from the MySQL - Perl mailing list archive at Nabble.com.
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]