SQLite

Check-in [c433672dd8]
Login

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

Overview
Comment:Fix sqlite3rbu_close() so that the pzErrmsg parameter may be passed NULL.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c433672dd8ab625628bde2f4f40a2dc000ed915dbe91833d3f753d8ab51baf25
User & Date: dan 2017-06-13 16:52:34.629
Context
2017-06-15
00:52
Enhance the sqlite3_analyzer.exe utility so that it computes and shows the number of bytes of metadata on btree pages and per table and index entry. (check-in: 43ad41efa9 user: drh tags: trunk)
2017-06-13
16:52
Fix sqlite3rbu_close() so that the pzErrmsg parameter may be passed NULL. (check-in: c433672dd8 user: dan tags: trunk)
04:31
Fix the processing of double-negatives in WHERE clause constraints with STAT4. Ticket [cfa2c908f2182] (check-in: 35b34bdf08 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/rbu/rbuvacuum.test.
294
295
296
297
298
299
300








301
302
303
304
305
306
307
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315







+
+
+
+
+
+
+
+







  sqlite3rbu_vacuum rbu test.db state.db
  rbu step
} {SQLITE_ERROR}
do_test 2.1.2 {
  list [catch { rbu close } msg] $msg
} {1 {SQLITE_ERROR - cannot vacuum wal mode database}}

do_test 2.1.3 {
  sqlite3rbu_vacuum rbu test.db state.db
  rbu step
} {SQLITE_ERROR}
do_test 2.1.4 {
  list [catch { rbu close_no_error } msg] $msg
} {1 SQLITE_ERROR}

reset_db
do_execsql_test 2.2.0 {
  CREATE TABLE tx(a PRIMARY KEY, b BLOB);
  INSERT INTO tx VALUES(1, randomblob(900));
  INSERT INTO tx SELECT a+1, randomblob(900) FROM tx;
  INSERT INTO tx SELECT a+2, randomblob(900) FROM tx;
  INSERT INTO tx SELECT a+4, randomblob(900) FROM tx;
Changes to ext/rbu/sqlite3rbu.c.
3783
3784
3785
3786
3787
3788
3789

3790




3791
3792
3793
3794
3795
3796
3797
3783
3784
3785
3786
3787
3788
3789
3790

3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801







+
-
+
+
+
+







    sqlite3_close(p->dbMain);
    rbuDeleteVfs(p);
    sqlite3_free(p->aBuf);
    sqlite3_free(p->aFrame);

    rbuEditErrmsg(p);
    rc = p->rc;
    if( pzErrmsg ){
    *pzErrmsg = p->zErrmsg;
      *pzErrmsg = p->zErrmsg;
    }else{
      sqlite3_free(p->zErrmsg);
    }
    sqlite3_free(p->zState);
    sqlite3_free(p);
  }else{
    rc = SQLITE_NOMEM;
    *pzErrmsg = 0;
  }
  return rc;
Changes to ext/rbu/sqlite3rbu.h.
416
417
418
419
420
421
422
423
424
425
426




427
428
429
430
431
432
433
416
417
418
419
420
421
422




423
424
425
426
427
428
429
430
431
432
433







-
-
-
-
+
+
+
+







**
** If the RBU update has been completely applied, mark the RBU database
** as fully applied. Otherwise, assuming no error has occurred, save the
** current state of the RBU update appliation to the RBU database.
**
** If an error has already occurred as part of an sqlite3rbu_step()
** or sqlite3rbu_open() call, or if one occurs within this function, an
** SQLite error code is returned. Additionally, *pzErrmsg may be set to
** point to a buffer containing a utf-8 formatted English language error
** message. It is the responsibility of the caller to eventually free any 
** such buffer using sqlite3_free().
** SQLite error code is returned. Additionally, if pzErrmsg is not NULL,
** *pzErrmsg may be set to point to a buffer containing a utf-8 formatted
** English language error message. It is the responsibility of the caller to
** eventually free any such buffer using sqlite3_free().
**
** Otherwise, if no error occurs, this function returns SQLITE_OK if the
** update has been partially applied, or SQLITE_DONE if it has been 
** completely applied.
*/
int sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);

Changes to ext/rbu/test_rbu.c.
74
75
76
77
78
79
80

81
82
83
84
85
86
87
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88







+







    {"create_rbu_delta", 2, ""},  /* 2 */
    {"savestate", 2, ""},         /* 3 */
    {"dbMain_eval", 3, "SQL"},    /* 4 */
    {"bp_progress", 2, ""},       /* 5 */
    {"db", 3, "RBU"},             /* 6 */
    {"state", 2, ""},             /* 7 */
    {"progress", 2, ""},          /* 8 */
    {"close_no_error", 2, ""},    /* 9 */
    {0,0,0}
  };
  int iCmd;

  if( objc<2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "METHOD");
    return TCL_ERROR;
98
99
100
101
102
103
104

105
106
107
108

109




110
111
112
113
114
115
116
99
100
101
102
103
104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122







+




+
-
+
+
+
+







  switch( iCmd ){
    case 0: /* step */ {
      int rc = sqlite3rbu_step(pRbu);
      Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
      break;
    }

    case 9: /* close_no_error */ 
    case 1: /* close */ {
      char *zErrmsg = 0;
      int rc;
      Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
      if( iCmd==1 ){
      rc = sqlite3rbu_close(pRbu, &zErrmsg);
        rc = sqlite3rbu_close(pRbu, &zErrmsg);
      }else{
        rc = sqlite3rbu_close(pRbu, 0);
      }
      if( rc==SQLITE_OK || rc==SQLITE_DONE ){
        Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
        assert( zErrmsg==0 );
      }else{
        Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
        if( zErrmsg ){
          Tcl_AppendResult(interp, " - ", zErrmsg, 0);