My question is a little about python but mostly about algorithms.
I am currently working on a Python parser for SQLite queries especially the INSERT query. The parser will have to recognize the table for the query and isolate each new value.
But I have an issue with recognizing the values in a column which can be filled with one of two methods :
insert into WeirdTable ("PARAMETERS","NAME","VALUE") VALUES (NULL,"BOB","0965");
insert into WeirdTable ("PARAMETERS","NAME","VALUE") VALUES ("Param1,Param2,Param3","Joe","00859");
insert into WeirdTable ("PARAMETERS","NAME","VALUE") VALUES ("Param1,Param2,Param3,Param4","Jack","00855");
insert into WeirdTable ("PARAMETERS","NAME","VALUE") VALUES ("Param1","Bill","00159");
the parameters column can take either : NULL or "Param1,Param2,....."
I first based my parsing on the number of commas inside the second set of brackets but since the number of parameters can change it corrupts the way I coded it. I also tried to use the number of quotes but since there can be NULL for parameters it didn't work either.
Do you have any ideas ?
Thank a lot
Aucun commentaire:
Enregistrer un commentaire