0
I’m trying to give a insert
in a table, but it gives syntax error. I believe it is because of the accent, but even searching can not solve.
Log error:
11-19 00:34:52.959: W/Aquery(21157): Reporting:android.database.sqlite.Sqliteexception: near "water": syntax error (code 1): , while compiling: INSERT OR REPLACE into noticia (noticia_id, content, title, summary, image, date) VALUES (10228, 'A Chapada Diamantina reserves true natural monuments for those who venture in their ways: some of the highest and beautiful waterfalls of Brazil are here, as a reward, at the end of the trail, for the effort of the travelers. Dazzle yourself with the imposing of the ten largest falls in the region, in images selected by Guidebook.
Insert in the code:
String query = "INSERT OR REPLACE into noticia (noticia_id, conteudo, titulo, resumo, imagem, data) VALUES (" + n.getId() + ", '" + n.getPost_content().replaceAll("’", "")
+ "', '" + n.getPost_title() + "', '" + n.getPost_excerpt().replaceAll("’", "") + "', '" + n.getImagem() + "', '" + n.getPost_modified() + "');";
mDb.execSQL(query);
I believe in place of
replaceAll("’", "")
should bereplaceAll("'", "")
.– Bacco