RE: Efficient select/insert

2005-04-27 Thread mark.d.andrews
: Jonathan Mangin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 26, 2005 4:14 PM To: dbi-users@perl.org Subject: Efficient select/insert I would like to select several rows from one table and insert them into another nearly identical table using Perl/DBI: my @array = $q-param(); # HTML

Efficient select/insert

2005-04-26 Thread Jonathan Mangin
I would like to select several rows from one table and insert them into another nearly identical table using Perl/DBI: my @array = $q-param(); # HTML checkboxes foreach my $element (@array) { my $sql = select col2, col3, col4 from table1 where col1 = ?; my $sth =

Re: Efficient select/insert

2005-04-26 Thread Philip M. Gollucci
Jonathan Mangin wrote: I would like to select several rows from one table and insert them into another nearly identical table using Perl/DBI: my @array = $q-param(); # HTML checkboxes foreach my $element (@array) { $dbh-do(INSERT INTO t (col1, ...) SELECT col1, ... FROM t2 WHERE x =

RE: Efficient select/insert

2005-04-26 Thread Reidy, Ron
by ... insert into table2 (col_list) select col_list from table1 - Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From: Jonathan Mangin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 26, 2005 2:14 PM To: dbi-users@perl.org Subject: Efficient select/insert I

Re: Efficient select/insert

2005-04-26 Thread JupiterHost.Net
$dbh-do(INSERT INTO t (col1, ...) SELECT col1, ... FROM t2 WHERE x = '$element'); Oi SQL injection warning! Red lights and sirens - don't do that!! '$element' is supper dangerouse, evil evil evil either $dbh-quote it or use ? in your prepare/execute dance: $dbh-do( 'INSERT INTO t

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- Original Message - From: Philip M. Gollucci [EMAIL PROTECTED] To: Jonathan Mangin [EMAIL PROTECTED] Cc: dbi-users@perl.org Sent: Tuesday, April 26, 2005 3:19 PM Subject: Re: Efficient select/insert Jonathan Mangin wrote: I would like to select several rows from one table and insert

Re: Efficient select/insert

2005-04-26 Thread Eric
At 01:13 PM 4/26/2005, Jonathan Mangin wrote: I would like to select several rows from one table and insert them into another nearly identical table using Perl/DBI: my @array = $q-param(); # HTML checkboxes foreach my $element (@array) { my $sql = select col2, col3, col4 from table1

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- Original Message - From: Eric [EMAIL PROTECTED] To: Jonathan Mangin [EMAIL PROTECTED]; dbi-users@perl.org Sent: Tuesday, April 26, 2005 3:43 PM Subject: Re: Efficient select/insert At 01:13 PM 4/26/2005, Jonathan Mangin wrote: I would like to select several rows from one table

Re: Efficient select/insert

2005-04-26 Thread Eric
At 02:13 PM 4/26/2005, Jonathan Mangin wrote: - Original Message - From: Eric [EMAIL PROTECTED] To: Jonathan Mangin [EMAIL PROTECTED]; dbi-users@perl.org Sent: Tuesday, April 26, 2005 3:43 PM Subject: Re: Efficient select/insert At 01:13 PM 4/26/2005, Jonathan Mangin wrote: I would like

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
Do these selects first and push the results into an array of arrays. Then prepare your insert and loop through your array on the execute portion only. Short of multiline inserts that should be your fastest way to do things. Doesn't this (below) affect my ability to do that? I don't really know.