mirror of
https://github.com/cldellow/sqlite-parquet-vtable.git
synced 2025-04-09 10:09:45 +00:00
Escape column names in CREATE
Fixes #33 Add test case with a hyphen and an embedded quotation mark
This commit is contained in:
parent
65e47e5828
commit
d3128498b1
BIN
parquet-generator/weird-column-names.parquet
Normal file
BIN
parquet-generator/weird-column-names.parquet
Normal file
Binary file not shown.
@ -52,7 +52,16 @@ std::string ParquetTable::CreateStatement() {
|
|||||||
if(i > 0)
|
if(i > 0)
|
||||||
text += ", ";
|
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;
|
std::string type;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user