SQLite Forum

insert a uuid:string '0Xcd...' -> 1/logic-error near "0Xcd" , syntax error
Login

insert a uuid:string '0Xcd...' -> 1/logic-error near "0Xcd" , syntax error

(1.1) By agraeper on 2020-11-09 12:56:51 edited from 1.0 [link] [source]

hello,

table objekt (
  id varchar(64)
 , ..
)

query 'insert into objekt(id,nu,na,ty,kz,tw,fu,ar,cr,er,gr,hr,kr,lr,rr,tr,ur) values('0XcdxC8pn9k93uig42TqAP',5205,'','MSR-Verteiler: MSR 3',0,0,'',81,0,1,1,0,11,1,21,6,0);'
ERROR check.prepare (1/SQL logic error) 'near "0Xcd": syntax error'

error-message: (result/sqlite3_errstr(result)) + sqlite3_errmsg(handle) 

thanks in advance,
andreas

this time, i found the mistake myself. 
but thanks for help in recent days.

(2) By Richard Hipp (drh) on 2020-11-09 12:58:10 in reply to 1.0 [link] [source]

Unable to reproduce the problem. Please send the complete text of the SQL that you are trying to evaluate.

(3) By doug (doug9forester) on 2020-11-09 15:38:36 in reply to 1.1 [source]

I find it strange that the query string reuses the single quote. No parser could handle this: query '....'..'..'..'..'..'..' What's up with that? Do you need to escape single quotes within your query quoted string?

(4) By Larry Brasfield (LarryBrasfield) on 2020-11-09 15:46:36 in reply to 3 [link] [source]

Yes, they are escaped with a single quote per escaped single quote.

(5) By agraeper on 2020-11-09 22:01:29 in reply to 4 [link] [source]

hi, thanks for your answers. the error was caused by another query. i did not think twice. my strings came from another source, already single-quoted, so " .. where id=''uuidstring'';" was the actual mistake.

if you want to say that 'a 'b' c' does not work. this is actually "a 'b' c". the outer single quotes from my simple printf-debugging. i know about "'" and '"'. but if you think of something different, i would like to know.