Re: DBI Issue with MySQL query



Of course it's a string. It was a typo.

my $rows = $dbh->do("LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS
TERMINATED BY '|'");

'db.table' == "database_name.table_name"

Paul DuBois <paul@xxxxxxxxx> 10-May-06 09:13:47 AM >>>

On 5/10/06 7:58, "Mark Galbreath" <GalbreathM@xxxxxxx> wrote:

Hi guys,

The following query works fine from the MySQL client:

LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS TERMINATED BY '|'

but fails in perl with a malformed SQL syntax error:

my $rows = $dbh->do(LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS
TERMINATED BY '|');

Anybody have a clue as to why this will not work?

That hasn't the faintest hope of working. You should post the actual code
that you're using. do() with a non-string argument is surely not your
actual code.

Also, 'db.table' doesn't look like a valid quoted identifier.






Relevant Pages

  • Re: DBI Issue with MySQL query
    ... Don't put single quotes around the table name. ... The following query works fine from the MySQL client: ... LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS TERMINATED BY '|' ...
    (perl.dbi.users)
  • Re: DBI Issue with MySQL query
    ... Don't put single quotes around the table name. ... The following query works fine from the MySQL client: ... LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS TERMINATED BY '|' ...
    (perl.dbi.users)
  • Re: Update field with contents of another field
    ... but everything I find points to typo errors. ... I've looked very closely at the query and find none. ... What is causing that prompt? ... but I get a message saying Syntax error, ...
    (microsoft.public.access.queries)
  • Re: Sarge problems with MySQL and DBI / DBD::mysql
    ... > with the mysql client. ... successfully returns 0 rows, so $dbh->selectrow_arrayis "undef". ... so the part of your query after the "or" gets run. ... error message which claims the query produced a DBI error, ...
    (Debian-User)
  • Re: Queries and OO
    ... > code with typos in unfamiliar syntax is too much of a burden. ... query is supposed to do. ... table vs. Movie implemented as an object? ...
    (comp.object)