*** DRAFT ***

SQLite Requirement Matrix Details
last_insert_rowid.html

Index Summary Markup Original


R-42639-56137-32346-60663-52828-48959-18769-50856 tcl slt th3 src

Each entry in most SQLite tables (except for WITHOUT ROWID tables) has a unique 64-bit signed integer key called the "rowid".

th3/cov1/withoutrowid01.test:14

/* IMP: R-42639-56137 */
# EVIDENCE-OF: R-42639-56137 Each entry in most SQLite tables (except
# for WITHOUT ROWID tables) has a unique 64-bit signed integer key
# called the "rowid".

R-21003-54221-59589-12513-12600-39825-11085-16301 tcl slt th3 src

The rowid is always available as an undeclared column named ROWID, OID, or _ROWID_ as long as those names are not also used by explicitly declared columns.

th3/cov1/withoutrowid01.test:24

/* IMP: R-21003-54221 */
# EVIDENCE-OF: R-21003-54221 The rowid is always available as an
# undeclared column named ROWID, OID, or _ROWID_ as long as those names
# are not also used by explicitly declared columns.

R-58089-05908-32254-07731-27981-33321-41774-40378 tcl slt th3 src

If the table has a column of type INTEGER PRIMARY KEY then that column is another alias for the rowid.

/* IMP: R-58089-05908 */
# EVIDENCE-OF: R-58089-05908 If the table has a column of type INTEGER
# PRIMARY KEY then that column is another alias for the rowid.

R-36596-35603-05344-10987-20238-56026-42130-18053 tcl slt th3 src

The sqlite3_last_insert_rowid(D) interface usually returns the rowid of the most recent successful INSERT into a rowid table or virtual table on database connection D.

/* IMP: R-36596-35603 */
# EVIDENCE-OF: R-36596-35603 The sqlite3_last_insert_rowid(D) interface
# usually returns the rowid of the most recent successful INSERT into a
# rowid table or virtual table on database connection D.

R-40676-08516-16968-48123-39083-47673-52246-45004 tcl slt th3 src

Inserts into WITHOUT ROWID tables are not recorded.

th3/cov1/withoutrowid01.test:196

/* IMP: R-40676-08516 */
# EVIDENCE-OF: R-40676-08516 Inserts into WITHOUT ROWID tables are not
# recorded.

R-14350-55458-23472-59439-25847-10170-60896-21467 tcl slt th3 src

If no successful INSERTs into rowid tables have ever occurred on the database connection D, then sqlite3_last_insert_rowid(D) returns zero.

th3/cov1/withoutrowid01.test:199

/* IMP: R-14350-55458 */
# EVIDENCE-OF: R-14350-55458 If no successful INSERTs into rowid tables
# have ever occurred on the database connection D, then
# sqlite3_last_insert_rowid(D) returns zero.

R-46934-63022-13283-12249-18112-11687-53025-24870 tcl slt th3 src

If an INSERT occurs within a trigger then this routine will return the rowid of the inserted row as long as the trigger is running. Once the trigger program ends, the value returned by this routine reverts to what it was before the trigger was fired.

/* IMP: R-46934-63022 */
# EVIDENCE-OF: R-46934-63022 If an INSERT occurs within a trigger then
# this routine will return the rowid of the inserted row as long as the
# trigger is running. Once the trigger program ends, the value returned
# by this routine reverts to what it was before the trigger was fired.

R-29588-44058-56045-00722-36389-33824-35706-30523 tcl slt th3 src

An INSERT that fails due to a constraint violation is not a successful INSERT and does not change the value returned by this routine.

/* IMP: R-29588-44058 */
# EVIDENCE-OF: R-29588-44058 An INSERT that fails due to a constraint
# violation is not a successful INSERT and does not change the value
# returned by this routine.

R-09702-18252-10292-02056-28728-37972-55531-64507 tcl slt th3 src

Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, and INSERT OR ABORT make no changes to the return value of this routine when their insertion fails.

/* IMP: R-09702-18252 */
# EVIDENCE-OF: R-09702-18252 Thus INSERT OR FAIL, INSERT OR IGNORE,
# INSERT OR ROLLBACK, and INSERT OR ABORT make no changes to the return
# value of this routine when their insertion fails.

R-48887-45097-32252-48133-01081-61153-45933-38095 tcl slt th3 src

When INSERT OR REPLACE encounters a constraint violation, it does not fail. The INSERT continues to completion after deleting rows that caused the constraint problem so INSERT OR REPLACE will always change the return value of this interface.

/* IMP: R-48887-45097 */
# EVIDENCE-OF: R-48887-45097 When INSERT OR REPLACE encounters a
# constraint violation, it does not fail. The INSERT continues to
# completion after deleting rows that caused the constraint problem so
# INSERT OR REPLACE will always change the return value of this
# interface.

R-15264-45364-33795-29086-26475-46082-16234-09444 tcl slt th3 src

For the purposes of this routine, an INSERT is considered to be successful even if it is subsequently rolled back.

/* IMP: R-15264-45364 */
# EVIDENCE-OF: R-15264-45364 For the purposes of this routine, an INSERT
# is considered to be successful even if it is subsequently rolled back.