How to insert a unique ID into each SQLite row?

后端 未结 5 1679
孤街浪徒
孤街浪徒 2020-12-14 06:54

I have the following SQLite code. How do I insert an auto generating unique ID into each row?

    tx.executeSql(\'DROP TABLE IF EXISTS ENTRIES\');
    tx.exe         


        
5条回答
  •  不思量自难忘°
    2020-12-14 07:50

    for the INSERT, better provide a "null" value for the corresponding autoincrement value's question mark placeholder.

     tx.executeSql('INSERT INTO ENTRIES (id, data) VALUES (?, ?)', [null, "First row"]);
    

提交回复
热议问题