aboutsummaryrefslogtreecommitdiff
path: root/src/vdbeblob.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-10-26 11:56:57 +0000
committerdan <dan@noemail.net>2010-10-26 11:56:57 +0000
commite3d82a872317dd0c2439d12147bcff5699c191a7 (patch)
treeb83574cc8330de081393ae08230c4b8930ed6c56 /src/vdbeblob.c
parentc7c91257d593c1864b2a49ac8adf3afb724b227d (diff)
downloadsqlite-e3d82a872317dd0c2439d12147bcff5699c191a7.tar.gz
sqlite-e3d82a872317dd0c2439d12147bcff5699c191a7.zip
Add missing header comments for changes related to the experimental sqlite3_blob_reopen() API.
FossilOrigin-Name: d1cc5c93f09c9092ec478c04e8d9a8b1f9c0cb04
Diffstat (limited to 'src/vdbeblob.c')
-rw-r--r--src/vdbeblob.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/vdbeblob.c b/src/vdbeblob.c
index 129aad736..1bfce65a6 100644
--- a/src/vdbeblob.c
+++ b/src/vdbeblob.c
@@ -33,16 +33,37 @@ struct Incrblob {
};
+/*
+** This function is used by both blob_open() and blob_reopen(). It seeks
+** the b-tree cursor associated with blob handle p to point to row iRow.
+** If successful, SQLITE_OK is returned and subsequent calls to
+** sqlite3_blob_read() or sqlite3_blob_write() access the specified row.
+**
+** If an error occurs, or if the specified row does not exist or does not
+** contain a value of type TEXT or BLOB in the column nominated when the
+** blob handle was opened, then an error code is returned and *pzErr may
+** be set to point to a buffer containing an error message. It is the
+** responsibility of the caller to free the error message buffer using
+** sqlite3DbFree().
+**
+** If an error does occur, then the b-tree cursor is closed. All subsequent
+** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will
+** immediately return SQLITE_ABORT.
+*/
static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
int rc; /* Error code */
char *zErr = 0; /* Error message */
Vdbe *v = (Vdbe *)p->pStmt;
+ /* Set the value of the SQL statements only variable to integer iRow.
+ ** This is done directly instead of using sqlite3_bind_int64() to avoid
+ ** triggering asserts related to mutexes.
+ */
+ assert( v->aVar[0].flags&MEM_Int );
v->aVar[0].u.i = iRow;
- rc = sqlite3_step(p->pStmt);
+ rc = sqlite3_step(p->pStmt);
if( rc==SQLITE_ROW ){
- Vdbe *v = (Vdbe *)p->pStmt;
u32 type = v->apCsr[0]->aType[p->iCol];
if( type<12 ){
zErr = sqlite3MPrintf(p->db, "cannot open value of type %s",