Skip to main content

is_autoincrement

Function is_autoincrement 

Source
pub fn is_autoincrement(create_sql: &str) -> bool
Expand description

Whether create_sql declares an ordinary rowid table with an INTEGER PRIMARY KEY AUTOINCREMENT column — the only form for which SQLite maintains a monotonic sqlite_sequence high-water mark.

Per the file format, AUTOINCREMENT is valid only immediately after INTEGER PRIMARY KEY, and never on a WITHOUT ROWID table (which has no rowid to auto-increment). So this is true iff the normalized, unquoted CREATE text contains the exact token run INTEGER PRIMARY KEY AUTOINCREMENT and does NOT carry the WITHOUT ROWID clause. Quoted identifiers / string literals / comments are stripped first (mirroring without_rowid_sql), so a column merely named "autoincrement", or the keyword inside a string, never matches.

This is a HINT input only: a true result means the table has an AUTOINCREMENT high-water mark the forensic layer can reconcile against, not that any particular row predates the current instance.