: 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
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 =
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
=
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
$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
- 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
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
- 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
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
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.
10 matches
Mail list logo