1
0
mirror of https://github.com/cldellow/sqlite-parquet-vtable.git synced 2025-04-05 09:49:48 +00:00

Escape column names in CREATE

Fixes 

Add test case with a hyphen and an embedded quotation mark
This commit is contained in:
Colin Dellow 2018-07-08 10:37:18 -04:00
parent 65e47e5828
commit d3128498b1
2 changed files with 10 additions and 1 deletions

Binary file not shown.

@ -52,7 +52,16 @@ std::string ParquetTable::CreateStatement() {
if(i > 0)
text += ", ";
text += col->name();
text += "\"";
// Horrifically inefficient, but easy to understand.
std::string colName = col->name();
for(char& c : colName) {
if(c == '"')
text += "\"\"";
else
text += c;
}
text += "\"";
std::string type;