> 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.
You need to separate these two issues. I doubt the problem is really
because you're both using CSV imports and having quoting issues. It's
one or the other. Find out which.
> // notice the required backticks
> q << "`" << row.at(2) << "` varchar(" << row.at(3)
> << ") NOT NULL
Why fight with manual quoting when MySQL++ can do it for you?
q << mysqlpp::quote << row.at(2) << ....
"quote" might not be the right manipulator for your situation. There
are several other related manipulators:
Once you figure out which one is correct, you can just start using it
reflexively instead of memorizing quoting rules.