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

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -