/ Check-in [3bd990be]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Set the connection error code when sqlite3_blob_read() or sqlite3_blob_write() fail. Ticket #2464. (CVS 4137)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3bd990be3cb8a74be9eaa8d5710852be6733cb58
User & Date: drh 2007-06-27 00:36:14
Context
2007-06-27
10:20
Make sure auto_vacuum is turned off before running the tests in pragma2.test. (CVS 4138) check-in: fc85c8aa user: drh tags: trunk
00:36
Set the connection error code when sqlite3_blob_read() or sqlite3_blob_write() fail. Ticket #2464. (CVS 4137) check-in: 3bd990be user: drh tags: trunk
00:08
Update the FAQ to describe how moving sqlite3 handles across threads is not safe with SQLITE_ENABLE_MEMORY_MANAGEMENT. Tickets #2357 and #2463. (CVS 4136) check-in: 2640f518 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbeblob.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
274
275
276
277
278
279
280

281
282
283
284
285
286
287
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code used to implement incremental BLOB I/O.
**
** $Id: vdbeblob.c,v 1.10 2007/05/08 20:37:40 drh Exp $
*/

#include "sqliteInt.h"
#include "vdbeInt.h"

#ifndef SQLITE_OMIT_INCRBLOB

................................................................................
  */
  db = v->db;
  rc = xCall(p->pCsr, iOffset+p->iOffset, n, z);
  if( rc==SQLITE_ABORT ){
    sqlite3VdbeFinalize(v);
    p->pStmt = 0;
  }else{

    v->rc = rc;
  }

  return sqlite3ApiExit(db, rc);
}

/*







|







 







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code used to implement incremental BLOB I/O.
**
** $Id: vdbeblob.c,v 1.11 2007/06/27 00:36:14 drh Exp $
*/

#include "sqliteInt.h"
#include "vdbeInt.h"

#ifndef SQLITE_OMIT_INCRBLOB

................................................................................
  */
  db = v->db;
  rc = xCall(p->pCsr, iOffset+p->iOffset, n, z);
  if( rc==SQLITE_ABORT ){
    sqlite3VdbeFinalize(v);
    p->pStmt = 0;
  }else{
    db->errCode = rc;
    v->rc = rc;
  }

  return sqlite3ApiExit(db, rc);
}

/*

Changes to test/incrblob.test.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
554
555
556
557
558
559
560
561

562












#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: incrblob.test,v 1.11 2007/06/15 15:08:08 danielk1977 Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!autovacuum || !pragma || !incrblob} {
  finish_test
................................................................................
    DELETE FROM t1 WHERE a = 123;
    PRAGMA INCREMENTAL_VACUUM(0);
  }
  seek $::b 0
  read $::b
} $::otherdata

finish_test





















|







 







|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: incrblob.test,v 1.12 2007/06/27 00:36:14 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!autovacuum || !pragma || !incrblob} {
  finish_test
................................................................................
    DELETE FROM t1 WHERE a = 123;
    PRAGMA INCREMENTAL_VACUUM(0);
  }
  seek $::b 0
  read $::b
} $::otherdata

# Attempt to write on a read-only blob.  Make sure the error code
# gets set.  Ticket #2464.
#
do_test incrblob-7.4 {
  set rc [catch {sqlite3_blob_write $::b 10 HELLO} msg]
  lappend rc $msg
} {1 SQLITE_READONLY}
do_test incrblob-7.5 {
  sqlite3_errcode db
} {SQLITE_READONLY}
do_test incrblob-7.6 {
  sqlite3_errmsg db
} {attempt to write a readonly database}

finish_test