Documentation Source Text

Check-in [4ce0a400c2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Documentation on the sqlite_offset() SQL function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4ce0a400c292f97c4115de5a521bdf55eb96856d923924137929f5235476e020
User & Date: drh 2018-01-04 19:28:02.519
Context
2018-01-08
12:05
Add new documentation file zipfile.in. (check-in: 99c2fcc179 user: dan tags: trunk)
2018-01-04
19:28
Documentation on the sqlite_offset() SQL function. (check-in: 4ce0a400c2 user: drh tags: trunk)
19:10
Flesh out the description of shadow tables and the rtreecheck() function in the R*Tree documentation. (check-in: 2ccafeedbe user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/changes.in.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
       [WITHOUT ROWID] tables.
</ol>
<li> Added the [https://sqlite.org/src/file/ext/misc/btreeinfo.c|sqlite_btreeinfo]
     eponymous virtual table for introspecting and estimating the sizes of
     the btrees in a database.
<li> Enhance the [SQLITE_ENABLE_UPDATE_DELETE_LIMIT] compile-time option so
     that it works for [WITHOUT ROWID] tables.
<li> Provide the sqlite_unsupported_offset(X) SQL function that returns
     the byte offset into the database file to the beginning of the record
     holding value X, when compiling with -DSQLITE_ENABLE_OFFSET_SQL_FUNC.
}

chng {2017-10-24 (3.21.0)} {
<li> Take advantage of the atomic-write capabilities in the 
     [https://en.wikipedia.org/wiki/F2FS|F2FS filesystem] when available, for
     greatly reduced transaction overhead.  This currently requires the
     [SQLITE_ENABLE_BATCH_ATOMIC_WRITE] compile-time option.







|

|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
       [WITHOUT ROWID] tables.
</ol>
<li> Added the [https://sqlite.org/src/file/ext/misc/btreeinfo.c|sqlite_btreeinfo]
     eponymous virtual table for introspecting and estimating the sizes of
     the btrees in a database.
<li> Enhance the [SQLITE_ENABLE_UPDATE_DELETE_LIMIT] compile-time option so
     that it works for [WITHOUT ROWID] tables.
<li> Provide the [sqlite_offset(X)] SQL function that returns
     the byte offset into the database file to the beginning of the record
     holding value X, when compiling with [-DSQLITE_ENABLE_OFFSET_SQL_FUNC].
}

chng {2017-10-24 (3.21.0)} {
<li> Take advantage of the atomic-write capabilities in the 
     [https://en.wikipedia.org/wiki/F2FS|F2FS filesystem] when available, for
     greatly reduced transaction overhead.  This currently requires the
     [SQLITE_ENABLE_BATCH_ATOMIC_WRITE] compile-time option.
Changes to pages/compile.in.
967
968
969
970
971
972
973











974
975
976
977
978
979
980
  databases generated with this option enabled are prone to
  triggering the
  [https://www.sqlite.org/src/info/e6e962d6b0f06f46e|e6e962d6b0f06f46]
  bug in the [sqlite3_blob_reopen()] interface.  For those reasons,
  this optimization is disabled by default.  However, this optimization
  may be enabled by default in a future release of SQLite.
}












COMPILE_OPTION {SQLITE_ENABLE_PREUPDATE_HOOK} {
  This option enables 
  [sqlite3_preupdate_hook|several new APIs] that provide callbacks
  prior to any change to a [rowid table].  The callbacks can be used
  to record the state of the row before the change occurs.
  <p>The action of the preupdate hook is similar to the







>
>
>
>
>
>
>
>
>
>
>







967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
  databases generated with this option enabled are prone to
  triggering the
  [https://www.sqlite.org/src/info/e6e962d6b0f06f46e|e6e962d6b0f06f46]
  bug in the [sqlite3_blob_reopen()] interface.  For those reasons,
  this optimization is disabled by default.  However, this optimization
  may be enabled by default in a future release of SQLite.
}

COMPILE_OPTION {SQLITE_ENABLE_OFFSET_SQL_FUNC} {
  This option enables support for the [sqlite_offset(X)] SQL function.
  <p>
  The [sqlite_offset(X)] SQL function requires a new interface on the
  B-tree storage engine, a new opcode in the [virtual machine] that
  runs SQL statements, and a new conditional in a critical path of the
  code generator.  To avoid that overhead in applications that do not
  need the utility of sqlite_offset(X), the function is disabled by
  default.
}

COMPILE_OPTION {SQLITE_ENABLE_PREUPDATE_HOOK} {
  This option enables 
  [sqlite3_preupdate_hook|several new APIs] that provide callbacks
  prior to any change to a [rowid table].  The callbacks can be used
  to record the state of the row before the change occurs.
  <p>The action of the preupdate hook is similar to the
Changes to pages/lang.in.
2671
2672
2673
2674
2675
2676
2677















2678
2679
2680
2681
2682
2683
2684
  ^The sqlite_compileoption_used() SQL function is a wrapper around the
  [sqlite3_compileoption_used()] C/C++ function.
  ^When the argument X to sqlite_compileoption_used(X) is a string which
  is the name of a compile-time option, this routine returns true (1) or
  false (0) depending on whether or not that option was used during the
  build.
}
















funcdef {sqlite_source_id()} {} {
  ^The sqlite_source_id() function returns a string that identifies the
  specific version of the source code that was used to build the SQLite
  library.  ^The string returned by sqlite_source_id() is
  the date and time that the source code was checked in followed by
  the SHA1 hash for that check-in.  ^This function is







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
  ^The sqlite_compileoption_used() SQL function is a wrapper around the
  [sqlite3_compileoption_used()] C/C++ function.
  ^When the argument X to sqlite_compileoption_used(X) is a string which
  is the name of a compile-time option, this routine returns true (1) or
  false (0) depending on whether or not that option was used during the
  build.
}

funcdef {sqlite_offset(X)} {} {
  ^The sqlite_offset(X) function returns the byte offset in the database
  file for the beginning of the record from which value would be read.
  If X is not a column in an ordinary table, then sqlite_offset(X) returns
  NULL.  The value returned by sqlite_offset(X) might reference either the
  original table or an index, depending on the query.  If the value X would
  normally be extracted from an index, the sqlite_offset(X) returns the
  offset to the corresponding index record.  If the value X would be
  extracted from the original table, then sqlite_offset(X) returns the offset
  to the table record.

  <p>The sqlite_offset(X) SQL function is only available if SQLite is built
  using the [-DSQLITE_ENABLE_OFFSET_SQL_FUNC] compile-time option.
}

funcdef {sqlite_source_id()} {} {
  ^The sqlite_source_id() function returns a string that identifies the
  specific version of the source code that was used to build the SQLite
  library.  ^The string returned by sqlite_source_id() is
  the date and time that the source code was checked in followed by
  the SHA1 hash for that check-in.  ^This function is