ResetCount
The value of the change counter is copied to the database handle change counter (returned by subsequent calls to sqlite3_changes()).
An example
3 of the 178 statements we compiled against the sample database use ResetCount. This is the one with the shortest program; the rows that use ResetCount are highlighted.
UPDATE tracks SET price = 1.29 WHERE id = 5
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 25 | 0 | 0 | |
| 1 | Null | 0 | 1 | 2 | 0 | |
| 2 | Noop | 3 | 0 | 1 | 0 | |
| 3 | OpenWrite | 0 | 4 | 0 | 6 | 0 |
| 4 | Integer | 5 | 16 | 0 | 0 | |
| 5 | SeekRowid | 0 | 7 | 16 | 0 | |
| 6 | Rowid | 0 | 2 | 0 | 0 | |
| 7 | IsNull | 2 | 24 | 0 | 0 | |
| 8 | Rowid | 0 | 3 | 0 | 0 | |
| 9 | Null | 0 | 4 | 0 | 0 | |
| 10 | Null | 0 | 5 | 0 | 0 | |
| 11 | Null | 0 | 6 | 0 | 0 | |
| 12 | Null | 0 | 7 | 0 | 0 | |
| 13 | Null | 0 | 8 | 0 | 0 | |
| 14 | Copy | 2 | 9 | 0 | 0 | |
| 15 | Null | 0 | 10 | 0 | 0 | |
| 16 | Column | 0 | 1 | 11 | 0 | |
| 17 | Column | 0 | 2 | 12 | 0 | |
| 18 | Column | 0 | 3 | 13 | 0 | |
| 19 | Column | 0 | 4 | 14 | 0 | |
| 20 | Real | 171798692 | 15 | 1072997335 | 0 | |
| 21 | MakeRecord | 10 | 6 | 1 | DDBDDE | 0 |
| 22 | Insert | 0 | 1 | 9 | tracks | 5 |
| 23 | Program | 2 | 24 | 17 | program | 1 |
| 24 | Halt | 0 | 0 | 0 | 0 | |
| 25 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 26 | Goto | 0 | 1 | 0 | 0 | |
| 0 | Init | 0 | 1 | 0 | -- TRIGGER tracks_touch | 0 |
| 1 | Trace | 2147483647 | 1 | 0 | -- UPDATE albums SET year = year WHERE id = new.album_id | 0 |
| 2 | Null | 0 | 1 | 2 | 0 | |
| 3 | Noop | 1 | 0 | 1 | 0 | |
| 4 | OpenWrite | 0 | 3 | 0 | 4 | 0 |
| 5 | Param | 9 | 7 | 0 | 0 | |
| 6 | SeekRowid | 0 | 8 | 7 | 0 | |
| 7 | Rowid | 0 | 2 | 0 | 0 | |
| 8 | IsNull | 2 | 15 | 0 | 0 | |
| 9 | Null | 0 | 3 | 0 | 0 | |
| 10 | Column | 0 | 1 | 4 | 0 | |
| 11 | Column | 0 | 2 | 5 | 0 | |
| 12 | Column | 0 | 3 | 6 | 0 | |
| 13 | MakeRecord | 3 | 4 | 1 | DDBD | 0 |
| 14 | Insert | 0 | 1 | 2 | albums | 5 |
| 15 | ResetCount | 0 | 0 | 0 | 0 | |
| 16 | Halt | 0 | 0 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Copy, Goto, Halt, Init, Insert, Integer, IsNull, MakeRecord, Noop, Null, OpenWrite, Param, Program, Real, Rowid, SeekRowid, Trace, Transaction.
What the SQLite documentation says
The value of the change counter is copied to the database handle change counter (returned by subsequent calls to sqlite3_changes()). Then the VMs internal change counter resets to 0. This is used by trigger programs.
From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.
← ReopenIdx · ResetSorter →