diff options
author | dan <dan@noemail.net> | 2010-12-06 17:11:05 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-12-06 17:11:05 +0000 |
commit | eefab7512bfe4d43b3f868d80e3818aa61db01bc (patch) | |
tree | 634d4aa3dd439979d1baf604956d564ba2baa707 /src | |
parent | 7a856fa64ae77f60b74d8f18e37f7232ef150135 (diff) | |
download | sqlite-eefab7512bfe4d43b3f868d80e3818aa61db01bc.tar.gz sqlite-eefab7512bfe4d43b3f868d80e3818aa61db01bc.zip |
Have sqlite3_blob_bytes() return 0 following a failed call to sqlite3_reopen_blob().
FossilOrigin-Name: 476a8b492124d31e0656e61a6183ab55684c0bdf
Diffstat (limited to 'src')
-rw-r--r-- | src/sqlite.h.in | 3 | ||||
-rw-r--r-- | src/vdbeblob.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 5b67b7abd..240a3bab2 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4835,7 +4835,8 @@ int sqlite3_blob_open( ** SQLite error code is returned and the blob handle is considered aborted. ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return -** SQLITE_ABORT. +** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle +** always returns zero. ** ** ^This function sets the database handle error code and message. */ diff --git a/src/vdbeblob.c b/src/vdbeblob.c index f43fc6499..f26cc87ea 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -419,7 +419,7 @@ int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){ */ int sqlite3_blob_bytes(sqlite3_blob *pBlob){ Incrblob *p = (Incrblob *)pBlob; - return p ? p->nByte : 0; + return (p && p->pStmt) ? p->nByte : 0; } /* @@ -457,6 +457,7 @@ int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ } rc = sqlite3ApiExit(db, rc); + assert( rc==SQLITE_OK || p->pStmt==0 ); sqlite3_mutex_leave(db->mutex); return rc; } |