Import the automatic comment generating changes from trunk.

FossilOrigin-Name: 8bb51da1305d5e35c7b75bbb176c21e04ea2a48a
This commit is contained in:
drh
2013-10-29 20:47:26 +00:00
6 changed files with 243 additions and 39 deletions
+9 -9
View File
@@ -1,5 +1,5 @@
C Improved\scomments\son\sthe\sconstraint\schecking\slogic.
D 2013-10-29T16:14:35.997
C Import\sthe\sautomatic\scomment\sgenerating\schanges\sfrom\strunk.
D 2013-10-29T20:47:26.079
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -145,8 +145,8 @@ F main.mk c6a433cb334bbb019625c137ab5d5e7568b47cff
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338
F mkopcodec.awk f6fccee29e68493bfd90a2e0466ede5fa94dd2fc
F mkopcodeh.awk e7334b45c023b5ee2efc6e8f479560c2026fa34a
F mkopcodec.awk 393b20a2a99557ca695f7e1261c32d087ff7c0b4
F mkopcodeh.awk 987ee588ff3bb4043bed2185c1ee2bdc39b1e526
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@@ -279,11 +279,11 @@ F src/update.c e39378bc5ed0c42e80624229703e59b5c7a4d50a
F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
F src/vdbe.c 7d23d61c84cb1116e36a70b050f2a4ae1a2aaae3
F src/vdbe.c cb3df2d7b2ebadf22a39efcfb12a1277e273616e
F src/vdbe.h 4f554b5627f26710c4c36d919110a3fc611ca5c4
F src/vdbeInt.h 42dcff74dbeb2b071e569b53f885fc9c2e4b4cb0
F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed
F src/vdbeaux.c 4ccdfd27f97fec98385f53fc8c880f1873137d95
F src/vdbeaux.c 3c36d92d3ad7225e0436474f4256243e5ceaeabb
F src/vdbeblob.c ef973d8d9f8170015343dd8824f795da675caa87
F src/vdbemem.c 6087553f2c61c06c8e1ab3959a60e174d6240c98
F src/vdbesort.c 3937e06b2a0e354500e17dc206ef4c35770a5017
@@ -1127,7 +1127,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 9f8191d1d833acaaf612fdff8cc6bd544c042986
R 1ffaeb4130b0ebfe6aa0338f8dfd6db1
P 141a38a7a636e3e4255b59c27df4a1b3d6f26e97 5f310c6a22b8bb5f860296074aee130c14101681
R 092c8ad63995bcb3387c2f88e6abbbb4
U drh
Z 4dc4c03fad5693ab5ce15641b23c251b
Z 2daff0292132d8122decef0d377e8179
+1 -1
View File
@@ -1 +1 @@
141a38a7a636e3e4255b59c27df4a1b3d6f26e97
8bb51da1305d5e35c7b75bbb176c21e04ea2a48a
+17 -3
View File
@@ -12,22 +12,36 @@ BEGIN {
print "/* Automatically generated. Do not edit */"
print "/* See the mkopcodec.awk script for details. */"
printf "#if !defined(SQLITE_OMIT_EXPLAIN)"
printf " || !defined(NDEBUG)"
printf " || defined(VDBE_PROFILE)"
print " || defined(SQLITE_DEBUG)"
print "#if defined(SQLITE_DEBUG)"
print "# define OpHelp(X) \"\\0\" X"
print "#else"
print "# define OpHelp(X)"
print "#endif"
print "const char *sqlite3OpcodeName(int i){"
print " static const char *const azName[] = { \"?\","
mx = 0
}
/define OP_/ {
/^.define OP_/ {
sub("OP_","",$2)
i = $3+0
label[i] = $2
if( mx<i ) mx = i
for(j=5; j<NF; j++) if( $j=="synopsis:" ) break
if( j<NF ){
j++
x = $j
for(j=j+1; j<NF; j++) x = x " " $j
synopsis[i] = x
}else{
synopsis[i] = ""
}
}
END {
for(i=1; i<=mx; i++){
printf " /* %3d */ \"%s\",\n", i, label[i]
printf " /* %3d */ %-18s OpHelp(\"%s\"),\n", i, \
"\"" label[i] "\"", synopsis[i]
}
print " };"
print " return azName[i];"
+53 -3
View File
@@ -38,6 +38,33 @@
tk[$2] = 0+$3 # tk[x] holds the numeric value for TK symbol X
}
# Find "/* Opcode: " lines in the vdbe.c file. Each one introduces
# a new opcode. Remember which parameters are used.
/^.. Opcode: / {
currentOp = "OP_" $3
m = 0
for(i=4; i<=NF; i++){
x = $i
if( x=="P1" ) m += 1
if( x=="P2" ) m += 2
if( x=="P3" ) m += 4
if( x=="P4" ) m += 8
if( x=="P5" ) m += 16
}
paramused[currentOp] = m
}
# Find "** Synopsis: " lines that follow Opcode:
/^.. Synopsis: / {
if( currentOp ){
x = $3
for(i=4; i<=NF; i++){
x = x " " $i
}
synopsis[currentOp] = x
}
}
# Scan for "case OP_aaaa:" lines in the vdbe.c file
/^case OP_/ {
name = $2
@@ -136,10 +163,22 @@ END {
if( !used[i] ){
def[i] = "OP_NotUsed_" i
}
printf "#define %-25s %15d", def[i], i
printf "#define %-16s %3d", def[i], i
com = ""
if( sameas[i] ){
printf " /* same as %-12s*/", sameas[i]
}
com = "same as " sameas[i]
}
x = synopsis[def[i]]
if( x ){
if( com=="" ){
com = "synopsis: " x
} else {
com = com ", synopsis: " x
}
}
if( com!="" ){
printf " /* %-42s */", com
}
printf "\n"
}
@@ -180,4 +219,15 @@ END {
if( i%8==7 ) printf("\\\n");
}
print "}"
if( 0 ){
print "\n/* Bitmask to indicate which fields (P1..P5) of each opcode are"
print "** actually used.\n*/"
print "#define OP_PARAM_USED_INITIALIZER {\\"
for(i=0; i<=max; i++){
if( i%8==0 ) printf("/* %3d */",i)
printf " 0x%02x,", paramused[def[i]]
if( i%8==7 ) printf("\\\n");
}
print "}"
}
}
+86 -2
View File
@@ -805,6 +805,7 @@ case OP_Yield: { /* in1 */
}
/* Opcode: HaltIfNull P1 P2 P3 P4 *
** Synopsis: if r[P3] null then halt
**
** Check the value in register P3. If it is NULL then Halt using
** parameter P1, P2, and P4 as if this were a Halt instruction. If the
@@ -882,6 +883,7 @@ case OP_Halt: {
}
/* Opcode: Integer P1 P2 * * *
** Synopsis: r[P2]=P1
**
** The 32-bit integer value P1 is written into register P2.
*/
@@ -891,6 +893,7 @@ case OP_Integer: { /* out2-prerelease */
}
/* Opcode: Int64 * P2 * P4 *
** Synopsis: r[P2]=P4
**
** P4 is a pointer to a 64-bit integer value.
** Write that value into register P2.
@@ -903,6 +906,7 @@ case OP_Int64: { /* out2-prerelease */
#ifndef SQLITE_OMIT_FLOATING_POINT
/* Opcode: Real * P2 * P4 *
** Synopsis: r[P2]=P4
**
** P4 is a pointer to a 64-bit floating point value.
** Write that value into register P2.
@@ -916,6 +920,7 @@ case OP_Real: { /* same as TK_FLOAT, out2-prerelease */
#endif
/* Opcode: String8 * P2 * P4 *
** Synopsis: r[P2]='P4'
**
** P4 points to a nul terminated UTF-8 string. This opcode is transformed
** into an OP_String before it is executed for the first time.
@@ -950,6 +955,7 @@ case OP_String8: { /* same as TK_STRING, out2-prerelease */
}
/* Opcode: String P1 P2 * P4 *
** Synopsis: r[P2]='P4' (len=P1)
**
** The string value P4 of length P1 (bytes) is stored in register P2.
*/
@@ -964,6 +970,7 @@ case OP_String: { /* out2-prerelease */
}
/* Opcode: Null P1 P2 P3 * *
** Synopsis: r[P2..P3]=NULL
**
** Write a NULL into registers P2. If P3 greater than P2, then also write
** NULL into register P3 and every register in between P2 and P3. If P3
@@ -992,6 +999,7 @@ case OP_Null: { /* out2-prerelease */
/* Opcode: Blob P1 P2 * P4
** Synopsis: r[P2]=P4 (len=P1)
**
** P4 points to a blob of data P1 bytes long. Store this
** blob in register P2.
@@ -1005,6 +1013,7 @@ case OP_Blob: { /* out2-prerelease */
}
/* Opcode: Variable P1 P2 * P4 *
** Synopsis: r[P2]=parameter(P1,P4)
**
** Transfer the values of bound parameter P1 into register P2
**
@@ -1026,6 +1035,7 @@ case OP_Variable: { /* out2-prerelease */
}
/* Opcode: Move P1 P2 P3 * *
** Synopsis: r[P2]=r[P1] N=P3
**
** Move the values in register P1..P1+P3 over into
** registers P2..P2+P3. Registers P1..P1+P3 are
@@ -1068,6 +1078,7 @@ case OP_Move: {
}
/* Opcode: Copy P1 P2 P3 * *
** Synopsis: r[P2]=r[P1] N=P3
**
** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.
**
@@ -1096,6 +1107,7 @@ case OP_Copy: {
}
/* Opcode: SCopy P1 P2 * * *
** Synopsis: r[P2]=r[P1]
**
** Make a shallow copy of register P1 into register P2.
**
@@ -1120,6 +1132,7 @@ case OP_SCopy: { /* in1, out2 */
}
/* Opcode: ResultRow P1 P2 * * *
** Synopsis: output=r[P1].. columns=P1
**
** The registers P1 through P1+P2-1 contain a single row of
** results. This opcode causes the sqlite3_step() call to terminate
@@ -1191,6 +1204,7 @@ case OP_ResultRow: {
}
/* Opcode: Concat P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]+r[P3]
**
** Add the text in register P1 onto the end of the text in
** register P2 and store the result in register P3.
@@ -1228,7 +1242,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
memcpy(pOut->z, pIn2->z, pIn2->n);
}
memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
pOut->z[nByte] = 0;
pOut->z[nByte]=0;
pOut->z[nByte+1] = 0;
pOut->flags |= MEM_Term;
pOut->n = (int)nByte;
@@ -1238,12 +1252,14 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
}
/* Opcode: Add P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]+r[P2]
**
** Add the value in register P1 to the value in register P2
** and store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Multiply P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]*r[P2]
**
**
** Multiply the value in register P1 by the value in register P2
@@ -1251,12 +1267,14 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
** If either input is NULL, the result is NULL.
*/
/* Opcode: Subtract P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]-r[P1]
**
** Subtract the value in register P1 from the value in register P2
** and store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Divide P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]/r[P2]
**
** Divide the value in register P1 by the value in register P2
** and store the result in register P3 (P3=P2/P1). If the value in
@@ -1264,6 +1282,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
** NULL, the result is NULL.
*/
/* Opcode: Remainder P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]%r[P2]
**
** Compute the remainder after integer division of the value in
** register P1 by the value in register P2 and store the result in P3.
@@ -1381,6 +1400,7 @@ case OP_CollSeq: {
}
/* Opcode: Function P1 P2 P3 P4 P5
** Synopsis: r[P3]=func(r[P2]..) N=P5
**
** Invoke a user function (P4 is a pointer to a Function structure that
** defines the function) with P5 arguments taken from register P2 and
@@ -1488,18 +1508,21 @@ case OP_Function: {
}
/* Opcode: BitAnd P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]&r[P2]
**
** Take the bit-wise AND of the values in register P1 and P2 and
** store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: BitOr P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]|r[P2]
**
** Take the bit-wise OR of the values in register P1 and P2 and
** store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: ShiftLeft P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]<<r[P1]
**
** Shift the integer value in register P2 to the left by the
** number of bits specified by the integer in register P1.
@@ -1507,6 +1530,7 @@ case OP_Function: {
** If either input is NULL, the result is NULL.
*/
/* Opcode: ShiftRight P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]>>r[P1]
**
** Shift the integer value in register P2 to the right by the
** number of bits specified by the integer in register P1.
@@ -1566,6 +1590,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */
}
/* Opcode: AddImm P1 P2 * * *
** Synopsis: r[P1]=r[P1]+P2
**
** Add the constant P2 to the value in register P1.
** The result is always an integer.
@@ -1724,6 +1749,7 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
#endif /* !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT) */
/* Opcode: Lt P1 P2 P3 P4 P5
** Synopsis: r[P1] < r[P3]
**
** Compare the values in register P1 and P3. If reg(P3)<reg(P1) then
** jump to address P2.
@@ -1758,6 +1784,7 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
** bit set.
*/
/* Opcode: Ne P1 P2 P3 P4 P5
** Synopsis: r[P1] != r[P3]
**
** This works just like the Lt opcode except that the jump is taken if
** the operands in registers P1 and P3 are not equal. See the Lt opcode for
@@ -1770,6 +1797,7 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
** the SQLITE_NULLEQ flag were omitted from P5.
*/
/* Opcode: Eq P1 P2 P3 P4 P5
** Synopsis: r[P1] == r[P3]
**
** This works just like the Lt opcode except that the jump is taken if
** the operands in registers P1 and P3 are equal.
@@ -1782,18 +1810,21 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
** the SQLITE_NULLEQ flag were omitted from P5.
*/
/* Opcode: Le P1 P2 P3 P4 P5
** Synopsis: r[P1] <= r[P3]
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is less than or equal to the content of
** register P1. See the Lt opcode for additional information.
*/
/* Opcode: Gt P1 P2 P3 P4 P5
** Synopsis: r[P1] > r[P3]
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than the content of
** register P1. See the Lt opcode for additional information.
*/
/* Opcode: Ge P1 P2 P3 P4 P5
** Synopsis: r[P1] >= r[P3]
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than or equal to the content of
@@ -1984,6 +2015,7 @@ case OP_Jump: { /* jump */
}
/* Opcode: And P1 P2 P3 * *
** Synopsis: r[P3]=(r[P1] && r[P2])
**
** Take the logical AND of the values in registers P1 and P2 and
** write the result into register P3.
@@ -1993,6 +2025,7 @@ case OP_Jump: { /* jump */
** a NULL output.
*/
/* Opcode: Or P1 P2 P3 * *
** Synopsis: r[P3]=(r[P1] || r[P2])
**
** Take the logical OR of the values in register P1 and P2 and
** store the answer in register P3.
@@ -2036,6 +2069,7 @@ case OP_Or: { /* same as TK_OR, in1, in2, out3 */
}
/* Opcode: Not P1 P2 * * *
** Synopsis: r[P2]= !r[P1]
**
** Interpret the value in register P1 as a boolean value. Store the
** boolean complement in register P2. If the value in register P1 is
@@ -2053,6 +2087,7 @@ case OP_Not: { /* same as TK_NOT, in1, out2 */
}
/* Opcode: BitNot P1 P2 * * *
** Synopsis: r[P1]= ~r[P1]
**
** Interpret the content of register P1 as an integer. Store the
** ones-complement of the P1 value into register P2. If P1 holds
@@ -2141,6 +2176,7 @@ case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */
}
/* Opcode: Column P1 P2 P3 P4 P5
** Synopsis: r[P3]=PX
**
** Interpret the data that cursor P1 points to as a structure built using
** the MakeRecord instruction. (See the MakeRecord opcode for additional
@@ -2477,6 +2513,7 @@ op_column_out:
}
/* Opcode: Affinity P1 P2 * P4 *
** Synopsis: affinity(r[P1]) N=P2
**
** Apply affinities to a range of P2 registers starting with P1.
**
@@ -2503,6 +2540,7 @@ case OP_Affinity: {
}
/* Opcode: MakeRecord P1 P2 P3 P4 *
** Synopsis: r[P3]=rec(r[P1]..) N=P2
**
** Convert P2 registers beginning with P1 into the [record format]
** use as a data record in a database table or as a key
@@ -2635,6 +2673,7 @@ case OP_MakeRecord: {
}
/* Opcode: Count P1 P2 * * *
** Synopsis: r[P2]=count()
**
** Store the number of entries (an integer value) in the table or index
** opened by cursor P1 in register P2
@@ -3111,6 +3150,7 @@ case OP_VerifyCookie: {
}
/* Opcode: OpenRead P1 P2 P3 P4 P5
** Synopsis: root=P2 iDb=P3
**
** Open a read-only cursor for the database table whose root page is
** P2 in a database file. The database file is determined by P3.
@@ -3141,6 +3181,7 @@ case OP_VerifyCookie: {
** See also OpenWrite.
*/
/* Opcode: OpenWrite P1 P2 P3 P4 P5
** Synopsis: root=P2 iDb=P3
**
** Open a read/write cursor named P1 on the table or index whose root
** page is P2. Or if P5!=0 use the content of register P2 to find the
@@ -3246,6 +3287,7 @@ case OP_OpenWrite: {
}
/* Opcode: OpenEphemeral P1 P2 * P4 P5
** Synopsis: nColumn=P2
**
** Open a new cursor P1 to a transient table.
** The cursor is always opened read/write even if
@@ -3263,6 +3305,7 @@ case OP_OpenWrite: {
** added automatically.
*/
/* Opcode: OpenAutoindex P1 P2 * P4 *
** Synopsis: nColumn=P2
**
** This opcode works the same as OP_OpenEphemeral. It has a
** different name to distinguish its use. Tables created using
@@ -3317,6 +3360,7 @@ case OP_OpenEphemeral: {
}
/* Opcode: SorterOpen P1 P2 * P4 *
** Synopsis: nColumn=P2
**
** This opcode works like OP_OpenEphemeral except that it opens
** a transient index that is specifically designed to sort large
@@ -3335,6 +3379,7 @@ case OP_SorterOpen: {
}
/* Opcode: OpenPseudo P1 P2 P3 * P5
** Synopsis: content in r[P2].. N=P3
**
** Open a new cursor that points to a fake table that contains a single
** row of data. The content of that one row in the content of memory
@@ -3377,6 +3422,7 @@ case OP_Close: {
}
/* Opcode: SeekGe P1 P2 P3 P4 *
** Synopsis: key=r[P3].. N=P4
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
** use the value in register P3 as the key. If cursor P1 refers
@@ -3390,6 +3436,7 @@ case OP_Close: {
** See also: Found, NotFound, Distinct, SeekLt, SeekGt, SeekLe
*/
/* Opcode: SeekGt P1 P2 P3 P4 *
** Synopsis: key=r[P3].. N=P4
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
** use the value in register P3 as a key. If cursor P1 refers
@@ -3403,6 +3450,7 @@ case OP_Close: {
** See also: Found, NotFound, Distinct, SeekLt, SeekGe, SeekLe
*/
/* Opcode: SeekLt P1 P2 P3 P4 *
** Synopsis: key=r[P3].. N=P4
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
** use the value in register P3 as a key. If cursor P1 refers
@@ -3416,6 +3464,7 @@ case OP_Close: {
** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLe
*/
/* Opcode: SeekLe P1 P2 P3 P4 *
** Synopsis: key=r[P3].. N=P4
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
** use the value in register P3 as a key. If cursor P1 refers
@@ -3581,6 +3630,7 @@ case OP_SeekGt: { /* jump, in3 */
}
/* Opcode: Seek P1 P2 * * *
** Synopsis: intkey=r[P2]
**
** P1 is an open table cursor and P2 is a rowid integer. Arrange
** for P1 to move so that it points to the rowid given by P2.
@@ -3608,6 +3658,7 @@ case OP_Seek: { /* in2 */
/* Opcode: Found P1 P2 P3 P4 *
** Synopsis: key=r[P3].. N=P4
**
** If P4==0 then register P3 holds a blob constructed by MakeRecord. If
** P4>0 then register P3 is the first of P4 registers that form an unpacked
@@ -3620,6 +3671,7 @@ case OP_Seek: { /* in2 */
** See also: NotFound, NoConflict, NotExists. SeekGe
*/
/* Opcode: NotFound P1 P2 P3 P4 *
** Synopsis: key=r[P3] N=P4
**
** If P4==0 then register P3 holds a blob constructed by MakeRecord. If
** P4>0 then register P3 is the first of P4 registers that form an unpacked
@@ -3727,6 +3779,7 @@ case OP_Found: { /* jump, in3 */
}
/* Opcode: NotExists P1 P2 P3 * *
** Synopsis: intkey=r[P3]
**
** P1 is the index of a cursor open on an SQL table btree (with integer
** keys). P3 is an integer rowid. If P1 does not contain a record with
@@ -3779,6 +3832,7 @@ case OP_NotExists: { /* jump, in3 */
}
/* Opcode: Sequence P1 P2 * * *
** Synopsis: r[P2]=rowid
**
** Find the next available sequence number for cursor P1.
** Write the sequence number into register P2.
@@ -3794,6 +3848,7 @@ case OP_Sequence: { /* out2-prerelease */
/* Opcode: NewRowid P1 P2 P3 * *
** Synopsis: r[P2]=rowid
**
** Get a new integer record number (a.k.a "rowid") used as the key to a table.
** The record number is not previously used as a key in the database
@@ -3943,6 +3998,7 @@ case OP_NewRowid: { /* out2-prerelease */
}
/* Opcode: Insert P1 P2 P3 P4 P5
** Synopsis: intkey=r[P3] data=r[P2]
**
** 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
@@ -3982,6 +4038,7 @@ case OP_NewRowid: { /* out2-prerelease */
** for indices is OP_IdxInsert.
*/
/* Opcode: InsertInt P1 P2 P3 P4 P5
** Synopsis: intkey=P3 data=r[P2]
**
** This works exactly like OP_Insert except that the key is the
** integer value P3, not the value of the integer stored in register P3.
@@ -4132,6 +4189,7 @@ case OP_ResetCount: {
}
/* Opcode: SorterCompare P1 P2 P3
** Synopsis: if key(P1)!=r[P3] goto P2
**
** P1 is a sorter cursor. This instruction compares the record blob in
** register P3 with the entry that the sorter cursor currently points to.
@@ -4153,6 +4211,7 @@ case OP_SorterCompare: {
};
/* Opcode: SorterData P1 P2 * * *
** Synopsis: r[P2]=data
**
** Write into register P2 the current sorter data for sorter cursor P1.
*/
@@ -4167,6 +4226,7 @@ case OP_SorterData: {
}
/* Opcode: RowData P1 P2 * * *
** Synopsis: r[P2]=data
**
** Write into register P2 the complete row data for cursor P1.
** There is no interpretation of the data.
@@ -4177,6 +4237,7 @@ case OP_SorterData: {
** of a real table, not a pseudo-table.
*/
/* Opcode: RowKey P1 P2 * * *
** Synopsis: r[P2]=key
**
** Write into register P2 the complete row key for cursor P1.
** There is no interpretation of the data.
@@ -4249,6 +4310,7 @@ case OP_RowData: {
}
/* Opcode: Rowid P1 P2 * * *
** Synopsis: r[P2]=rowid
**
** Store in register P2 an integer which is the key of the table entry that
** P1 is currently point to.
@@ -4406,7 +4468,7 @@ case OP_Rewind: { /* jump */
break;
}
/* Opcode: Next P1 P2 * P4 P5
/* Opcode: Next P1 P2 * * P5
**
** Advance cursor P1 so that it points to the next key/data pair in its
** table or index. If there are no more key/value pairs then fall through
@@ -4476,6 +4538,7 @@ case OP_Next: { /* jump */
}
/* Opcode: IdxInsert P1 P2 P3 * P5
** Synopsis: key=r[P2]
**
** Register P2 holds an SQL index key made using the
** MakeRecord instructions. This opcode writes that key
@@ -4522,6 +4585,7 @@ case OP_IdxInsert: { /* in2 */
}
/* Opcode: IdxDelete P1 P2 P3 * *
** Synopsis: key=r[P2]..
**
** The content of P3 registers starting at register P2 form
** an unpacked index key. This opcode removes that entry from the
@@ -4558,6 +4622,7 @@ case OP_IdxDelete: {
}
/* Opcode: IdxRowid P1 P2 * * *
** Synopsis: r[P2]=rowid
**
** Write into register P2 an integer which is the last entry in the record at
** the end of the index key pointed to by cursor P1. This integer should be
@@ -4593,6 +4658,7 @@ case OP_IdxRowid: { /* out2-prerelease */
}
/* Opcode: IdxGE P1 P2 P3 P4 P5
** Synopsis: key=r[P3] N=P4
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the ROWID. Compare this key value against the index
@@ -4607,6 +4673,7 @@ case OP_IdxRowid: { /* out2-prerelease */
** the result is false whereas it would be true with IdxGT.
*/
/* Opcode: IdxLT P1 P2 P3 P4 P5
** Synopsis: key=r[P3] N=P4
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the ROWID. Compare this key value against the index
@@ -4759,6 +4826,7 @@ case OP_Clear: {
}
/* Opcode: CreateTable P1 P2 * * *
** Synopsis: r[P2]=root iDb=P1
**
** Allocate a new table in the main database file if P1==0 or in the
** auxiliary database file if P1==1 or in an attached database if
@@ -4772,6 +4840,7 @@ case OP_Clear: {
** See also: CreateIndex
*/
/* Opcode: CreateIndex P1 P2 * * *
** Synopsis: r[P2]=root iDb=P1
**
** Allocate a new index in the main database file if P1==0 or in the
** auxiliary database file if P1==1 or in an attached database if
@@ -4973,6 +5042,7 @@ case OP_IntegrityCk: {
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
/* Opcode: RowSetAdd P1 P2 * * *
** Synopsis: rowset(P1)=r[P2]
**
** Insert the integer value held by register P2 into a boolean index
** held in register P1.
@@ -4992,6 +5062,7 @@ case OP_RowSetAdd: { /* in1, in2 */
}
/* Opcode: RowSetRead P1 P2 P3 * *
** Synopsis: r[P3]=rowset(P1)
**
** Extract the smallest value from boolean index P1 and put that value into
** register P3. Or, if boolean index P1 is initially empty, leave P3
@@ -5015,6 +5086,7 @@ case OP_RowSetRead: { /* jump, in1, out3 */
}
/* Opcode: RowSetTest P1 P2 P3 P4
** Synopsis: if r[P3] in rowset(P1) goto P2
**
** Register P3 is assumed to hold a 64-bit integer value. If register P1
** contains a RowSet object and that RowSet object contains
@@ -5218,6 +5290,7 @@ case OP_Param: { /* out2-prerelease */
#ifndef SQLITE_OMIT_FOREIGN_KEY
/* Opcode: FkCounter P1 P2 * * *
** Synopsis: fkctr[P1]+=P2
**
** Increment a "constraint counter" by P2 (P2 may be negative or positive).
** If P1 is non-zero, the database constraint counter is incremented
@@ -5236,6 +5309,7 @@ case OP_FkCounter: {
}
/* Opcode: FkIfZero P1 P2 * * *
** Synopsis: if fkctr[P1]==0 goto P2
**
** This opcode tests if a foreign key constraint-counter is currently zero.
** If so, jump to instruction P2. Otherwise, fall through to the next
@@ -5258,6 +5332,7 @@ case OP_FkIfZero: { /* jump */
#ifndef SQLITE_OMIT_AUTOINCREMENT
/* Opcode: MemMax P1 P2 * * *
** Synopsis: r[P1]=max(r[P1],r[P2])
**
** P1 is a register in the root frame of this VM (the root frame is
** different from the current frame if this instruction is being executed
@@ -5288,6 +5363,7 @@ case OP_MemMax: { /* in2 */
#endif /* SQLITE_OMIT_AUTOINCREMENT */
/* Opcode: IfPos P1 P2 * * *
** Synopsis: if r[P1]>0 goto P2
**
** If the value of register P1 is 1 or greater, jump to P2.
**
@@ -5304,6 +5380,7 @@ case OP_IfPos: { /* jump, in1 */
}
/* Opcode: IfNeg P1 P2 * * *
** Synopsis: if r[P1]<0 goto P2
**
** If the value of register P1 is less than zero, jump to P2.
**
@@ -5320,6 +5397,7 @@ case OP_IfNeg: { /* jump, in1 */
}
/* Opcode: IfZero P1 P2 P3 * *
** Synopsis: r[P1]+=P3, if r[P1]==0 goto P2
**
** The register P1 must contain an integer. Add literal P3 to the
** value in register P1. If the result is exactly 0, jump to P2.
@@ -5338,6 +5416,7 @@ case OP_IfZero: { /* jump, in1 */
}
/* Opcode: AggStep * P2 P3 P4 P5
** Synopsis: accum=r[P3] step(r[P2]..) N=P5
**
** Execute the step function for an aggregate. The
** function has P5 arguments. P4 is a pointer to the FuncDef
@@ -5401,6 +5480,7 @@ case OP_AggStep: {
}
/* Opcode: AggFinal P1 P2 * P4 *
** Synopsis: accum=r[P1] N=P2
**
** Execute the finalizer function for an aggregate. P1 is
** the memory location that is the accumulator for the aggregate.
@@ -5628,6 +5708,7 @@ case OP_Expire: {
#ifndef SQLITE_OMIT_SHARED_CACHE
/* Opcode: TableLock P1 P2 P3 P4 *
** Synopsis: iDb=P1 root=P2 write=P3
**
** Obtain a lock on a particular table. This instruction is only used when
** the shared-cache feature is enabled.
@@ -5744,6 +5825,7 @@ case OP_VOpen: {
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VFilter P1 P2 P3 P4 *
** Synopsis: iPlan=r[P3] zPlan='P4'
**
** P1 is a cursor opened using VOpen. P2 is an address to jump to if
** the filtered result set is empty.
@@ -5818,6 +5900,7 @@ case OP_VFilter: { /* jump */
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VColumn P1 P2 P3 * *
** Synopsis: r[P3]=vcolumn(P2)
**
** Store the value of the P2-th column of
** the row of the virtual-table that the
@@ -5951,6 +6034,7 @@ case OP_VRename: {
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VUpdate P1 P2 P3 P4 *
** Synopsis: data=r[P3] N=P2
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** This opcode invokes the corresponding xUpdate method. P2 values
+77 -21
View File
@@ -856,6 +856,60 @@ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
}
}
#if defined(SQLITE_DEBUG)
/*
** Compute a string for the "comment" field of a VDBE opcode listing
*/
static int displayComment(Op *pOp, const char *zP4, char *zTemp, int nTemp){
const char *zOpName;
const char *zSynopsis;
int nOpName;
int ii, jj;
zOpName = sqlite3OpcodeName(pOp->opcode);
nOpName = sqlite3Strlen30(zOpName);
if( zOpName[nOpName+1] ){
int seenCom = 0;
zSynopsis = zOpName += nOpName + 1;
for(ii=jj=0; jj<nTemp-1 && zSynopsis[ii]; ii++){
if( zSynopsis[ii]=='P' ){
int v;
const char *zShow = 0;
ii++;
switch( zSynopsis[ii] ){
case '1': v = pOp->p1; break;
case '2': v = pOp->p2; break;
case '3': v = pOp->p3; break;
case '5': v = pOp->p5; break;
case '4': zShow = zP4; break;
case 'X': zShow = pOp->zComment; seenCom = 1; break;
}
if( zShow ){
sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zShow);
}else{
sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v);
}
jj += sqlite3Strlen30(zTemp+jj);
}else{
zTemp[jj++] = zSynopsis[ii];
}
}
if( !seenCom && jj<nTemp-5 && pOp->zComment ){
sqlite3_snprintf(nTemp-jj, zTemp+jj, "; %s", pOp->zComment);
jj += sqlite3Strlen30(zTemp+jj);
}
if( jj<nTemp ) zTemp[jj] = 0;
}else if( pOp->zComment ){
sqlite3_snprintf(nTemp, zTemp, "%s", pOp->zComment);
jj = sqlite3Strlen30(zTemp);
}else{
zTemp[0] = 0;
jj = 0;
}
return jj;
}
#endif /* SQLITE_DEBUG */
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \
|| defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
/*
@@ -1049,16 +1103,18 @@ void sqlite3VdbeLeave(Vdbe *p){
void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){
char *zP4;
char zPtr[50];
char zCom[100];
static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-4s %.2X %s\n";
if( pOut==0 ) pOut = stdout;
zP4 = displayP4(pOp, zPtr, sizeof(zPtr));
#ifdef SQLITE_DEBUG
displayComment(pOp, zP4, zCom, sizeof(zCom));
#else
zCom[0] = 0
#endif
fprintf(pOut, zFormat1, pc,
sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
#ifdef SQLITE_DEBUG
pOp->zComment ? pOp->zComment : ""
#else
""
#endif
zCom
);
fflush(pOut);
}
@@ -1204,7 +1260,7 @@ int sqlite3VdbeList(
rc = SQLITE_ERROR;
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(p->rc));
}else{
char *z;
char *zP4;
Op *pOp;
if( i<p->nOp ){
/* The output line number is small enough that we are still in the
@@ -1227,7 +1283,7 @@ int sqlite3VdbeList(
pMem++;
pMem->flags = MEM_Static|MEM_Str|MEM_Term;
pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
assert( pMem->z!=0 );
pMem->n = sqlite3Strlen30(pMem->z);
pMem->type = SQLITE_TEXT;
@@ -1274,9 +1330,9 @@ int sqlite3VdbeList(
return SQLITE_ERROR;
}
pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
z = displayP4(pOp, pMem->z, 32);
if( z!=pMem->z ){
sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);
zP4 = displayP4(pOp, pMem->z, 32);
if( zP4!=pMem->z ){
sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);
}else{
assert( pMem->z!=0 );
pMem->n = sqlite3Strlen30(pMem->z);
@@ -1298,18 +1354,18 @@ int sqlite3VdbeList(
pMem++;
#ifdef SQLITE_DEBUG
if( pOp->zComment ){
pMem->flags = MEM_Str|MEM_Term;
pMem->z = pOp->zComment;
pMem->n = sqlite3Strlen30(pMem->z);
pMem->enc = SQLITE_UTF8;
pMem->type = SQLITE_TEXT;
}else
#endif
{
pMem->flags = MEM_Null; /* Comment */
pMem->type = SQLITE_NULL;
if( sqlite3VdbeMemGrow(pMem, 500, 0) ){
assert( p->db->mallocFailed );
return SQLITE_ERROR;
}
pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
pMem->n = displayComment(pOp, zP4, pMem->z, 500);
pMem->type = SQLITE_TEXT;
pMem->enc = SQLITE_UTF8;
#else
pMem->flags = MEM_Null; /* Comment */
pMem->type = SQLITE_NULL;
#endif
}
p->nResColumn = 8 - 4*(p->explain-1);