SCopy
Make a shallow copy of register P1 into register P2.
An example
19 of the 178 statements we compiled against the sample database use SCopy. This is the one with the shortest program; the rows that use SCopy are highlighted.
INSERT OR REPLACE INTO genres VALUES ('Jazz', 'Swing')| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 12 | 0 | 0 | |
| 1 | OpenWrite | 1 | 9 | 0 | k(1,) | 0 |
| 2 | String8 | 0 | 2 | 0 | Jazz | 0 |
| 3 | String8 | 0 | 3 | 0 | Swing | 0 |
| 4 | Null | 0 | 1 | 0 | 0 | |
| 5 | HaltIfNull | 1299 | 2 | 2 | genres.name | 1 |
| 6 | Affinity | 2 | 2 | 0 | BB | 0 |
| 7 | SCopy | 2 | 5 | 0 | 0 | |
| 8 | SCopy | 3 | 6 | 0 | 0 | |
| 9 | MakeRecord | 5 | 2 | 4 | 0 | |
| 10 | IdxInsert | 1 | 4 | 5 | 1 | 17 |
| 11 | Halt | 0 | 0 | 0 | 0 | |
| 12 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 13 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Affinity, Goto, Halt, HaltIfNull, IdxInsert, Init, MakeRecord, Null, OpenWrite, String8, Transaction.
What the SQLite documentation says
Make a shallow copy of register P1 into register P2.
This instruction makes a shallow copy of the value. If the value is a string or blob, then the copy is only a pointer to the original and hence if the original changes so will the copy. Worse, if the original is deallocated, the copy becomes invalid. Thus the program must guarantee that the original will not change during the lifetime of the copy. Use Copy to make a complete copy.
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.