android - Getting quoted string using ContentValues for insertOrThrow -


how can quoted strings in contentvalues object used in sqlite insert? sqlite seems choking on : of value

    //inside loop of nodelist     contentvalues map = new contentvalues();     element elm;     elm = (element) nodes.item(i);     string elmname = elm.gettagname();     map.put("foto", getvalue(elm, "foto"));     map.put("fotonormal", getvalue(elm, "foto-normal"));     map.put("link", getvalue(elm, "link"));      mydatabase.begintransaction();     try {         mydatabase.insertorthrow(table_ending, null, map);         log.i(tag, "added");         mydatabase.settransactionsuccessful();     } catch (exception err) {         log.i(tag, "transaction failed. exception: " + err.getmessage());     } {         mydatabase.endtransaction();     } 

which gives me error

transaction failed. exception: unrecognized token: ":": insert tbl_ending (fotonormal, foto, link) values (https://example.com/fotonormal.jpg, https://example.com/foto.jpg, https://example.com/); 

i believe sql statement should

insert tbl_ending (fotonormal, foto, link) values ("https://example.com/fotonormal.jpg", "https://example.com/foto.jpg",  "https://example.com/"); 

how can output instead?

it strange behavior. have got weak typing going on in map.put statements, not help. inclined explicitly cast getvalue parameters, see if fixes problem, viz:

map.put("foto", (string) getvalue(elm, "foto")); map.put("fotonormal", (string) getvalue(elm, "foto-normal")); map.put("link", (string) getvalue(elm, "link")); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -