/ Changes On Branch sqlite3_snapshot_describe
Login

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

Changes In Branch sqlite3_snapshot_describe Excluding Merge-Ins

This is equivalent to a diff from f8b1c64d3e to 3fbfa9a8e8

2017-09-21
14:03
The sqlite3_snapshot_describe() interface useful for debugging snapshot logic. (Leaf check-in: 3fbfa9a8e8 user: drh tags: sqlite3_snapshot_describe)
10:24
Fix a bug in tool/mksourceid.c: The mksourceid.c program was incorrectly including the "# Remove this line" line of the Fossil-generated "manifest" file in the SHA3 hash. That means that all SQLITE_SOURCE_IDs for trunk versions going back to check-in [30966d56] (2017-08-22) are incorrect. (check-in: 65765222ef user: drh tags: trunk)
01:04
Revert one performance improvement changes from check-in [3b3e32d4cd07] as it was causing a reference to an uninitialized value. (check-in: f8b1c64d3e user: drh tags: trunk)
00:49
Fix the rendering of the P4_INTARRAY argument to the OP_IntegrityCk opcode in the output of EXPLAIN. (check-in: adc12c83dd user: drh tags: trunk)

Changes to src/sqlite.h.in.

8571
8572
8573
8574
8575
8576
8577

8578
8579
8580
8581
8582
8583
8584
*/
typedef struct sqlite3_snapshot {
  unsigned char hidden[48];
} sqlite3_snapshot;

/*
** CAPI3REF: Record A Database Snapshot

** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
** new [sqlite3_snapshot] object that records the current state of
** schema S in database connection D.  ^On success, the
** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.







>







8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
*/
typedef struct sqlite3_snapshot {
  unsigned char hidden[48];
} sqlite3_snapshot;

/*
** CAPI3REF: Record A Database Snapshot
** CONSTRUCTOR: sqlite3_snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
** new [sqlite3_snapshot] object that records the current state of
** schema S in database connection D.  ^On success, the
** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
8658
8659
8660
8661
8662
8663
8664

8665
8666
8667
8668
8669
8670
8671
  sqlite3 *db,
  const char *zSchema,
  sqlite3_snapshot *pSnapshot
);

/*
** CAPI3REF: Destroy a snapshot

** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
** The application must eventually free every [sqlite3_snapshot] object
** using this routine to avoid a memory leak.
**
** The [sqlite3_snapshot_free()] interface is only available when the







>







8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
  sqlite3 *db,
  const char *zSchema,
  sqlite3_snapshot *pSnapshot
);

/*
** CAPI3REF: Destroy a snapshot
** DESTRUCTOR: sqlite3_snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
** The application must eventually free every [sqlite3_snapshot] object
** using this routine to avoid a memory leak.
**
** The [sqlite3_snapshot_free()] interface is only available when the
8718
8719
8720
8721
8722
8723
8724
























8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
** transaction open on the database, or if the database is not a wal mode
** database.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);

























/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif /* SQLITE3_H */







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












8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
** transaction open on the database, or if the database is not a wal mode
** database.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);


/*
** CAPI3REF: Human-readable description of a snapshot
** EXPERIMENTAL
**
** The sqlite3_snapshot_describe(S,B,N) interface writes a human-readable
** description of snapshot S into the array of characters B of length N.
** As long as N is greater than 0, the string written into B is guaranteed
** to be zero terminated.
**
** This routine is intended for testing and debugging use only. The details
** of the text description written into B may vary from one release to the
** next.
**
** The [sqlite3_snapshot_describe()] interface is only available when the
** both the [SQLITE_ENABLE_SNAPSHOT] an [SQLITE_DEBUG] compile-time options
** are used.
*/
SQLITE_EXPERIMENTAL void sqlite3_snapshot_describe(
  sqlite3_snapshot*,   /* The snapshot to be described */
  char *pBuf,          /* Write the description into this buffer */
  int nBuf             /* Length of pBuf in bytes */
);

/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif /* SQLITE3_H */

Changes to src/wal.c.

3510
3511
3512
3513
3514
3515
3516























3517
3518
3519
3520
3521
3522
3523
  ** is incremented each time the wal file is restarted.  */
  if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1;
  if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
  if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
  if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
  return 0;
}























#endif /* SQLITE_ENABLE_SNAPSHOT */

#ifdef SQLITE_ENABLE_ZIPVFS
/*
** If the argument is not NULL, it points to a Wal object that holds a
** read-lock. This function returns the database page-size if it is known,
** or zero if it is not (or if pWal is NULL).







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







3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
  ** is incremented each time the wal file is restarted.  */
  if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1;
  if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
  if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
  if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
  return 0;
}

/*
** Write a human-readable description of a snapshot into a text buffer.
*/
void sqlite3_snapshot_describe(sqlite3_snapshot *pSS, char *z, int n){
  WalIndexHdr *p = (WalIndexHdr*)pSS;
  sqlite3_snprintf(n,z,
     "mxFrame %u "
     "nPage %u "
     "szPage %u "
     "iChange %u "
     "aFrameCksum 0x%08x%08x "
     "aSalt 0x%08x%08x "
     "iVersion %u ",
     p->mxFrame,
     p->nPage,
     p->szPage,
     p->iChange,
     p->aFrameCksum[0], p->aFrameCksum[1],
     p->aSalt[0], p->aSalt[1],
     p->iVersion
  );
}
#endif /* SQLITE_ENABLE_SNAPSHOT */

#ifdef SQLITE_ENABLE_ZIPVFS
/*
** If the argument is not NULL, it points to a Wal object that holds a
** read-lock. This function returns the database page-size if it is known,
** or zero if it is not (or if pWal is NULL).