小编clu*_*e11的帖子

尝试更新表时SQLite异常 - 无法识别的标记

我试图通过我的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)

sqlite android

3
推荐指数
1
解决办法
6990
查看次数

链接列表和指针说明

在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.nextprevious = n确实改变了传入的链表?

java linked-list

1
推荐指数
1
解决办法
57
查看次数

标签 统计

android ×1

java ×1

linked-list ×1

sqlite ×1