I have the following insert statement in my Angular application to insert into the local SQLite DB.
INSERT INTO testtable (ID, userID, goTime, backTime, imageFileNames) VALUES (8,1,"00:00:00","00:00:00","{\"images\":[\"U9P0v8302e5fnrHd3D0lk04CDDONdYEF1p1cDDICLpQMZDTZXgcCigeNEZZHdA0rvcfhrIouMixH6XUKOOCe64Hcrmkf5QZuc9YY.jpg\"]}");
I am having a syntax error thrown around the images section of the insert statement. I know this is because of the double quotes within and that added a extra " to the internal double quotes will work.
My questions is: is there a function or a way to easily add those extra double quotes where needed so that the statement becomes valid again?
CodePudding user response:
Maybe you could mix backtips (`) with single quotes (') and double quotes ("):
INSERT INTO testtable (ID, userID, goTime, backTime, imageFileNames)
VALUES (
8,
1,
"00:00:00",
"00:00:00",
`{"images:['U9P0v8302e5fnrHd3D0lk04CDDONdYEF1p1cDDICLpQMZDTZXgcCigeNEZZHdA0rvcfhrIouMixH6XUKOOCe64Hcrmkf5QZuc9YY.jpg']}"`
);
if it doesn't work, try this way:
"{`images:['U9P0v8302e5fnrHd3D0lk04CDDONdYEF1p1cDDICLpQMZDTZXgcCigeNEZZHdA0rvcfhrIouMixH6XUKOOCe64Hcrmkf5QZuc9YY.jpg']}`"