]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add support for the sqlite_unsupported_offset() SQL function if and only
authordrh <drh@noemail.net>
Fri, 29 Dec 2017 17:21:21 +0000 (17:21 +0000)
committerdrh <drh@noemail.net>
Fri, 29 Dec 2017 17:21:21 +0000 (17:21 +0000)
if compiled using -DSQLITE_ENABLE_OFFSET_SQL_FUNC.  Use that definition
when compiling the command-line shell.

FossilOrigin-Name: 4f1f1f521ae6da96b899e10bfeff6bc1ab7a45de0705076febaae20b441f48c6

1  2 
manifest
manifest.uuid
src/vdbe.c

diff --cc manifest
index 3e7d60e06a8824b5ece8e789176ca28c182175d3,6b6ae42bc2e89fa33931d610c64f841d86b2cadf..682ec0eee70c1d9b6e071a5c89d9ef98d6ef1ba9
+++ b/manifest
@@@ -1,8 -1,8 +1,8 @@@
- C Add\stest\scases\sfor\sthe\sundocumented\sbehavior\sof\sduplicate\scolumns\son\san\nINSERT\sor\sUPDATE.
- D 2017-12-29T12:50:43.938
- F Makefile.in ceb40bfcb30ebba8e1202b34c56ff7e13e112f9809e2381d99be32c2726058f5
 -C Stricter\stest\scases.
 -D 2017-12-29T16:37:33.070
++C Add\ssupport\sfor\sthe\ssqlite_unsupported_offset()\sSQL\sfunction\sif\sand\sonly\nif\scompiled\susing\s-DSQLITE_ENABLE_OFFSET_SQL_FUNC.\s\sUse\sthat\sdefinition\nwhen\scompiling\sthe\scommand-line\sshell.
++D 2017-12-29T17:21:21.319
+ F Makefile.in 804c347948b0ad5a962aea3e59413e897227e0173d0e76910f11f473e6c7ae9b
  F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
- F Makefile.msc 6480671f7c129e61208d69492b3c71ce4310d49fceac83cfb17f1c081e242b69
+ F Makefile.msc 57dcce0595d4a0c4b94b6f6ba732b8e33540358adf5fb8e1aa8389d34a9677e8
  F README.md eeae1e552f93ef72ef7c5b8f6647b368a001c28820ad1df179d3dae602bef681
  F VERSION 0c10cdfed866fdd2d80434f64f042c3330f1daaed12e54287beb104f04b3faaf
  F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@@ -547,7 -547,7 +547,7 @@@ F src/update.c 961bd1265d4d1e5cd65c9a54
  F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
  F src/util.c 7315e97a8dc2c8e19ca64196c652cf0a65d13fd0a211b2cec082062372dc6261
  F src/vacuum.c 90839322fd5f00df9617eb21b68beda9b6e2a2937576b0d65985e4aeb1c53739
- F src/vdbe.c e0a1ca7539d7071d5fa582bdf27195a51197b5ae1ab0f143888b1561df592fd0
 -F src/vdbe.c cb3b5035f337c9fed4a0170ca20325dc4500b832c57d00561310cbb78149a73c
++F src/vdbe.c c70267613df80345ed9bbd9c249c365b53bb9cbbe9d3e78e6d5c049d00ef5501
  F src/vdbe.h d50cadf12bcf9fb99117ef392ce1ea283aa429270481426b6e8b0280c101fd97
  F src/vdbeInt.h 1fe00770144c12c4913128f35262d11527ef3284561baaab59b947a41c08d0d9
  F src/vdbeapi.c 9c670ca0dcc1cd86373aa353b747b26fe531ca5cd4331690c611d1f03842e2a1
@@@ -1687,7 -1688,7 +1688,8 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9
  F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
  F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
  F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
- P 0fdf97efe5df745510c6b4b377a8ee5683a3a237630bfbd0f56e57c7c6e5b246
- R 9fe2cb7c2c9b946d64749c1df6cc4954
 -P 89e5720a8d8d46d4e2f16f15678e91336117e64abc977174e2b345a30308d0d2
 -R 9cb794037b97521b258cb5fdbbf60d53
++P f4349c0c26611de8a7d5beb99431a575cf531cdeb0ca2413efabcf0a61e6f424 9406c0a685fd5ff3516a66402b0514a1440652822a5eecf0b7af85929f3079e8
++R 35346abc344e9d51558b9d8d5c8f2d13
++T +closed 9406c0a685fd5ff3516a66402b0514a1440652822a5eecf0b7af85929f3079e8
  U drh
- Z 157cf27648c17a2b2af97b1730aa1c08
 -Z 8d1ee588df9bbfd069e3afd64819112f
++Z b5b643a0e7da393bb8589918154fc3c1
diff --cc manifest.uuid
index 3c028df06d1f5b46d003d58b5013a88da0c7081f,b37d8e1f54a750dee6487eaf84b109d33841eea2..1c26686ec72d5dff31b024198f9fc0bd3d126337
@@@ -1,1 -1,1 +1,1 @@@
- f4349c0c26611de8a7d5beb99431a575cf531cdeb0ca2413efabcf0a61e6f424
 -9406c0a685fd5ff3516a66402b0514a1440652822a5eecf0b7af85929f3079e8
++4f1f1f521ae6da96b899e10bfeff6bc1ab7a45de0705076febaae20b441f48c6
diff --cc src/vdbe.c
index 10055605626c098ad7c934ea52a2aa719b107c25,26336d940b31c344a94399c4213d3f53513eb6ca..4d643d7266859f982b164a32771e7e324ade0dc2
@@@ -2349,6 -2349,36 +2349,36 @@@ case OP_IfNullRow: {         /* jump *
    break;
  }
  
 -  if( pC==0 || pC->eCurType!=CURTYPE_BTREE ){
+ #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
+ /* Opcode: Offset P1 P2 P3 * *
+ ** Synopsis: r[P3] = sqlite_offset(P1)
+ **
+ ** Store in register r[P3] the byte offset into the database file that is the
+ ** start of the payload for the record at which that cursor P1 is currently
+ ** pointing.
+ **
+ ** P2 is the column number for the argument to the sqlite_offset() function.
+ ** This opcode does not use P2 itself, but the P2 value is used by the
+ ** code generator.  The P1, P2, and P3 operands to this opcode are the
+ ** as as for OP_Column.
+ **
+ ** This opcode is only available if SQLite is compiled with the
+ ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option.
+ */
+ case OP_Offset: {          /* out3 */
+   VdbeCursor *pC;    /* The VDBE cursor */
+   assert( pOp->p1>=0 && pOp->p1<p->nCursor );
+   pC = p->apCsr[pOp->p1];
+   pOut = &p->aMem[pOp->p3];
++  if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){
+     sqlite3VdbeMemSetNull(pOut);
+   }else{
+     sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor));
+   }
+   break;
+ }
+ #endif /* SQLITE_ENABLE_OFFSET_SQL_FUNC */
  /* Opcode: Column P1 P2 P3 P4 P5
  ** Synopsis: r[P3]=PX
  **