Re: DBI Issue with MySQL query



On Wed, May 10, 2006 at 09:26:52AM -0400, Mark Galbreath wrote:
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"

Don't put single quotes around the table name.

db.table
or `db`.`table`

should work, but 'db.table' won't.

Tim.

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
    ... It was a typo. ... 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: Proper Query Type
    ... I forgot to fix some of the syntax besides the single quotes in my ... Gunny ... Community, please sign in to the Community and mark these posts, so that all ... >> I want to make sure that I am using the right query type. ...
    (microsoft.public.access.queries)
  • Re: DBI Issue with MySQL query
    ... works for me with mysql client 5.0.15 and dbd::mysql 3.003_1. ... What does a DBI trace of 3 or above output? ... single quotes, double quotes, escaped ... LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS TERMINATED BY ...
    (perl.dbi.users)
  • Re: parameter query not prompting for parameter
    ... The single quotes were actually put in there by Access when I entered the ... try to save the query, ... > parameter literally as a string". ... us a control on a form as a criteria in your query. ...
    (microsoft.public.access.queries)