List:MySQL++« Previous MessageNext Message »
From:tazatek Date:June 19 2007 8:52pm
Subject:Quoting mis-understanding
View as plain text  

The gist of my problem is this:  I load data from a CSV file into a table.
The fields are unquoted.  I then read back parts of this table to create a
new table.  The problem is that the table that gets created is requiring
backticks because the import of data from a table to create another table is

Let me explain via code:

// load data from CSV file into property_map table
q << "load data infile '/home/matt/map.csv' into table property_map fields
terminated by ',' ";

  q << "select * from  property_map";
  Result res =;
     q << "create table property_temp( ";
      Row row;
      Row::size_type i;
      for (i=0; row =; ++i)
             // notice the required backticks 
	      q << "`" << << "` varchar(" << <<
default '', ";
      q << "PRIMARY KEY (`" << << "`) ) ENGINE=InnoDB;";


When I do a select * from property_map the fields are all quoted, and in the
mysql client, I have to use backticks to use the fields.

What am I doing wrong??   Is my Load Data command wrong?  Is my CSV format
wrong?  Am I trying to create the table incorrectly? ( NB:  This isn't my
preferred way to create a table.  I am forced to use a legacy system that
has there tables set up this way)

Any help is appreciated.




View this message in context:
Sent from the MySQL - C++ mailing list archive at

Quoting mis-understandingtazatek19 Jun
  • Re: Quoting mis-understandingWarren Young20 Jun