android - SQLite syntax error: while compiling: UPDATE contacts SET name=? WHERE phone=+34 -


in project, there's peace of code waiting called contentobserver when there's change on contact table. when happens, check every contact in table 1 one if had been changed or 1 had been created. depending on save changes on own table. gives me errors. there's code:

while (phones.movetonext()) { try { name = phones .getstring(phones .getcolumnindex(contactscontract.commondatakinds.phone.display_name)); phonenumber = phones .getstring(phones .getcolumnindex(contactscontract.commondatakinds.phone.number)); jsonobject jobject = db.select_contact(name, phonenumber); string type1 = jobject.getstring("type"); if (type1.equals("upload")) { log.i("********", "upload on db" + name + " " + phonenumber); db.contact_table(name, phonenumber); } else if (type1.equals("change_name")) { db.update_name(name, phonenumber); log.i("********", "change name , upload " + name); } else if (type1.equals("change_phone")) { db.update_name(name, phonenumber); log.i("********", "change phone , upload " + phonenumber); } } catch (exception ex) { ex.printstacktrace(); } } 

and there's part upload own table created me:

public long update_name(string name, string number) { contentvalues cv = new contentvalues(); cv.put(name, name); return ourdatabase.update(database_table_4, cv, number + "=" + number, null); } public long update_number(string name, string number) { contentvalues cv = new contentvalues(); cv.put(number, number); return ourdatabase .update(database_table_4, cv, name + "=" + name, null); } 

the problem on part of upload changes on db, gives me errors:

07-07 09:28:41.412: w/system.err(11667): android.database.sqlite.sqliteexception: near "629": syntax error: , while compiling: update contacts set name=? phone=+34 629 21 00 80 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitecompiledsql.native_compile(native method) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitecompiledsql.(sqlitecompiledsql.java:68) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqliteprogram.compilesql(sqliteprogram.java:143) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqliteprogram.compileandbindallargs(sqliteprogram.java:361) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitestatement.acquireandlock(sqlitestatement.java:260) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitestatement.executeupdatedelete(sqlitestatement.java:84) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitedatabase.updatewithonconflict(sqlitedatabase.java:1936) 07-07 09:28:41.412: w/system.err(11667): @ android.database.sqlite.sqlitedatabase.update(sqlitedatabase.java:1887) 07-07 09:28:41.412: w/system.err(11667): @ com.background.database.update_name(database.java:215) 07-07 09:28:41.417: w/system.err(11667): @ com.extract.contacts.onchange(contacts.java:69) 07-07 09:28:41.417: w/system.err(11667): @ android.database.contentobserver$notificationrunnable.run(contentobserver.java:43) 07-07 09:28:41.417: w/system.err(11667): @ android.os.handler.handlecallback(handler.java:605) 07-07 09:28:41.417: w/system.err(11667): @ android.os.handler.dispatchmessage(handler.java:92) 07-07 09:28:41.417: w/system.err(11667): @ android.os.looper.loop(looper.java:137) 07-07 09:28:41.417: w/system.err(11667): @ android.app.activitythread.main(activitythread.java:4507) 07-07 09:28:41.422: w/system.err(11667): @ java.lang.reflect.method.invokenative(native method) 07-07 09:28:41.422: w/system.err(11667): @ java.lang.reflect.method.invoke(method.java:511) 07-07 09:28:41.422: w/system.err(11667): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:790) 07-07 09:28:41.422: w/system.err(11667): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:557) 07-07 09:28:41.422: w/system.err(11667): @ dalvik.system.nativestart.main(native method)

thanks advanced! :)

this:

where phone=+34 629 21 00 80 

should this:

where phone="+34 629 21 00 80" 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -