I may not have expressed myself well, I have to migrate tables between two
databases that contain millions of rows and I only need specific columns.
Now it works using placeholders only for the values but is very slow for
inserts even with AutoCommit disabled.
Getting data from $src_db is f
On 4/9/21 7:11 AM, mailing lists via beginners wrote:
thanks Andrew
I need to insert millions of rows so I need to have a good performance
using placeholders
You can not use placeholders for the table name.
If you have millions of *tables*, there is something very, very, very
wrong with
I use mysql so I don't see what may be failing :-(
On Friday, April 9, 2021, 3:41:23 PM GMT+2, Andrew Solomon
wrote:
The problem is that this:
$sth = $dbh->prepare("SELECT * FROM ?");
$sth->execute("test") && say "OK";
translates to
SELECT * FROM "test";
rather than
SELECT * FROM te
thanks, but that only works when you don't use parameters for the placeholders
just try to do an insert like this:
$sth = $dbh->prepare("INSERT INTO ? (?) VALUES (?)");
foreach
{
$sth->execute("test","data1","data2") && say "OK 2";};
now you need to pass the parameters and they will f
The problem is that this:
$sth = $dbh->prepare("SELECT * FROM ?");
$sth->execute("test") && say "OK";
translates to
SELECT * FROM "test";
rather than
SELECT * FROM test;
This isn't a problem for Postgres but MySQL doesn't accept quoted table
names.
On Fri, Apr 9, 2021 at 1:25 PM mailing li
I'm using:
CentOS Linux release 7.9.2009 (Core)
perl 5.16.3
perl-DBD-MySQL-4.023
perl-DBI-1.627
On Friday, April 9, 2021, 2:19:13 PM GMT+2, mailing lists via beginners
wrote:
without using the variable $table it also fails with the same error
$sth = $dbh->prepare("SELECT * FROM ?");
without using the variable $table it also fails with the same error
$sth = $dbh->prepare("SELECT * FROM ?");$sth->execute("test") && say "OK";
On Friday, April 9, 2021, 2:12:01 PM GMT+2, mailing lists via beginners
wrote:
thanks Andrew
I need to insert millions of rows so I need
thanks Andrew
I need to insert millions of rows so I need to have a good performance using
placeholders
On Friday, April 9, 2021, 1:57:25 PM GMT+2, Andrew Solomon
wrote:
The ? is for quoting field values rather than entering table or field names.
"SELECT * FROM $table" is probably
The ? is for quoting field values rather than entering table or field
names. "SELECT * FROM $table" is probably what you want.
On Fri, Apr 9, 2021 at 12:49 PM mailing lists via beginners <
beginners@perl.org> wrote:
> Hello,
>
> I am having a problem with a very simple task and I don't see where