mirror of
				https://github.com/cldellow/sqlite-parquet-vtable.git
				synced 2025-10-31 02:19:56 +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:
		
							
								
								
									
										
											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; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Colin Dellow
					Colin Dellow