drg-adaptive / drg-adaptive/mysql-insert-csv

Fails to convert certain string fields

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

The field parsing seems to be a bit broken when parsing a CSV file. If a string field contains a `" ` (quote followed by a space), the field is not properly terminated by a closing `'` character. I ran into this issue where there are some text fields that refer to measurements like `1/2" ` and the SQL generated was improperly formatted. Here's an example:
`14463,NULL,00536991501,INSULIN SYRINGE/NEEDLE (generic MONOJECT INSULIN SYRINGE),DOES NOT APPLY,MISC,MISC,28G X 1/2" 1 ML,97051030906370,INSULIN SYRINGE/NEEDLE,INSULIN SYRINGE/NEEDLE U-100,N,G,B,0,1,0`
However, the SQL generated for this line is:
`(14463,NULL,'00536991501','INSULIN SYRINGE/NEEDLE (generic MONOJECT INSULIN SYRINGE)','DOES NOT APPLY','MISC','MISC','28G X 1/2\" 1 ML,97051030906370,INSULIN SYRINGE/NEEDLE,INSULIN SYRINGE/NEEDLE U-100,N,G,B,0,1,0\n14464,NULL,00536993001,EASY TOUCH INSULIN SYRINGE,DOES NOT APPLY,MISC,MISC,31G X 5/16\" 1 ML,97051030906387,EASY TOUCH INSULIN SYRINGE,INSULIN SYRINGE/NEEDLE U-100,N,T,B,0,1,0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
`
Note that this is also including the following line, but the closing quotes enclose other fields. This appears to be an issue whenever quotes are escaped as part of the string, rather than enclosing a string field (that includes a comma). I suspect this is just being incorrectly parsed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.