java - Prevent autoincrement of id after IGNORE INTO statement in sqlite -


i found few duplicate threads talking using option innodb_autoinc_lock_mode=0 don't know how in sqlite.

here code:

ps = conn.preparestatement("insert or ignore users(name, lastname) values(?, ?)"); ps.setstring(1, namefield.gettext()); ps.setstring(2, lastnfield.gettext()); int res = ps.executeupdate(); 

name , lastname set unique keys. works expected (doesn't insert if name , last name exist) autoincrements id every time. idea how approach either fixing autoincrement or changing sql code? i'm doing in java.

just remove autoincrement table definition.

a plain integer primaray key column still autoincrementing, not keep separate counter. instead, new rows next id after largest 1 in table.

autoincrement useful if want prevent ids deleted rows being reused.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -