Skip to content

Commit 9bf6e6e

Browse files
authored
Merge 'use i64 for registers p1,p2,p3,p5 in EXPLAIN output' from Mikaël Francoeur
To avoid overflows, use i64 for p1,p2,p3,p5 in EXPLAIN output. This matches SQLite's behaviour (https://github.com/sqlite/sqlite/blob/master /src/vdbeaux.c#L2460-L2476). I also changed the column type string for p4, there was a preexisting mismatch between the value type and the explicit type string. Closes #3944 Reviewed-by: Jussi Saurio <[email protected]> Closes #3961
2 parents 94cd61f + e65fbfe commit 9bf6e6e

File tree

5 files changed

+329
-321
lines changed

5 files changed

+329
-321
lines changed

bindings/javascript/packages/wasm/promise.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test('explain', async () => {
4040
},
4141
{
4242
"name": "p4",
43-
"type": "INTEGER",
43+
"type": "TEXT",
4444
},
4545
{
4646
"name": "p5",

cli/opcodes_dictionary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub const OPCODE_DESCRIPTIONS: [OpCodeDescription; 189] = [
101101
OpCodeDescription { name: "Insert", description: "Write an entry into the table of cursor P1. A new entry is created if it doesn't already exist or the data for an existing entry is overwritten. The data is the value MEM_Blob stored in register number P2. The key is stored in register P3. The key must be a MEM_Int. If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, then rowid is stored for subsequent return by the sqlite3_last_insert_rowid() function (otherwise it is unmodified). If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might run faster by avoiding an unnecessary seek on cursor P1. However, the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior seeks on the cursor or if the most recent seek used a key equal to P3. If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an UPDATE operation. Otherwise (if the flag is clear) then this opcode is part of an INSERT operation. The difference is only important to the update hook. Parameter P4 may point to a Table structure, or may be NULL. If it is not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked following a successful insert. (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically allocated, then ownership of P2 is transferred to the pseudo-cursor and register P2 becomes ephemeral. If the cursor is changed, the value of register P2 will then change. Make sure this does not cause any problems.) This instruction only works on tables. The equivalent instruction for indices is IdxInsert." },
102102
OpCodeDescription { name: "Int64", description: "P4 is a pointer to a 64-bit integer value. Write that value into register P2." },
103103
OpCodeDescription { name: "IntCopy", description: "Transfer the integer value held in register P1 into register P2. This is an optimized version of SCopy that works only for integer values." },
104-
OpCodeDescription { name: "Integer", description: "The 32-bit integer value P1 is written into register P2." },
104+
OpCodeDescription { name: "Integer", description: "The 64-bit integer value P1 is written into register P2. This is different from SQLite, where this opcode is used for 32-bit integers" },
105105
OpCodeDescription { name: "IntegrityCk", description: "Do an analysis of the currently open database. Store in register (P1+1) the text of an error message describing any problems. If no problems are found, store a NULL in register (P1+1). The register (P1) contains one less than the maximum number of allowed errors. At most reg(P1) errors will be reported. In other words, the analysis stops as soon as reg(P1) errors are seen. Reg(P1) is updated with the number of errors remaining. The root page numbers of all tables in the database are integers stored in P4_INTARRAY argument. If P5 is not zero, the check is done on the auxiliary database file, not the main database file. This opcode is used to implement the integrity_check pragma." },
106106
OpCodeDescription { name: "IsNull", description: "Jump to P2 if the value in register P1 is NULL." },
107107
OpCodeDescription { name: "IsTrue", description: "This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and IS NOT FALSE operators. Interpret the value in register P1 as a boolean value. Store that boolean (a 0 or 1) in register P2. Or if the value in register P1 is NULL, then the P3 is stored in register P2. Invert the answer if P4 is 1. The logic is summarized like this:

0 commit comments

Comments
 (0)