我试图通过我的SQLiteHelper类中的此方法更新我的SQLite数据库,我收到错误:
android.database.sqlite.SQLiteException: unrecognized token: "55c7e253afcf48" (code 1): , while compiling: UPDATE login SET user_group=? WHERE uid=55c7e253afcf48.85187730
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
Run Code Online (Sandbox Code Playgroud)
除了额外的".85187730"之外,uid是正确的......我不确定这些数字是什么意思.这是我的更新方法:
//updating sqlite database with the group name
public void updateUserGroup(String groupName) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_GROUP, groupName);
HashMap<String, String> user = getUserDetails();
String userID = user.get("uid");
System.out.println("User id is: " + userID);
db.update(TABLE_LOGIN, values, SQLiteHandler.KEY_UID + "=" + "userID", null);
}
/**
* Getting user data from database
* */
public HashMap<String, String> getUserDetails() …Run Code Online (Sandbox Code Playgroud) 在Cracking the Coding Interview Linked List问题中:编写代码以从未排序的链表中删除重复项,解决方案是
public static void deleteDups (LinkedListNode n){
Hashtable table = new Hashtable();
LinkedListNode previous = null;
while(n!=null){
if(table.containsKey(n.data)){
previous.next = n.next;
} else {
table.put(n.data, true);
previous = n;
}
n = n.next;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么不n = n.next改变传递给函数的链表,但是做previous.next = n.next和previous = n确实改变了传入的链表?