For info: Apostrophes & SQLite

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
glenn9
Posts: 223
Joined: Wed Jan 15, 2020 10:45 pm
Location: Europe

For info: Apostrophes & SQLite

Post by glenn9 » Thu Mar 03, 2022 3:08 pm

Dear all,

Just in case anyone else encounters a similar headache - SQLite will not add text containing an apostrophe (').

After encountering a problem where seemingly for random reasons text was not being stored by SQLite by (a lot) of trial and error I discovered that it text containing an apostrophe that was causing the problem!

(this link provided the answer: https://stackoverflow.com/questions/191 ... ngle-quote).

It seems that it is easily solved by 'doubling up' the apostrophe - which is easy in LC:

Code: Select all

replace "'" with "''" in fld"fQuestion"
Glenn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9647
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: For info: Apostrophes & SQLite

Post by dunbarx » Thu Mar 03, 2022 5:21 pm

Glenn.

I have fooled around with this sort of thing before, sometimes to substitute a common character, and sometimes to get around a limitation similar to what you are dealing with.

These chars, numToChar(212) and numToChar(213) both look like the apostrophe. You do not need the double char, which is off-putting when read.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”