From: dan Date: Tue, 26 Oct 2010 11:56:57 +0000 (+0000) Subject: Add missing header comments for changes related to the experimental sqlite3_blob_reop... X-Git-Tag: version-3.7.4~86^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3d82a872317dd0c2439d12147bcff5699c191a7;p=thirdparty%2Fsqlite.git Add missing header comments for changes related to the experimental sqlite3_blob_reopen() API. FossilOrigin-Name: d1cc5c93f09c9092ec478c04e8d9a8b1f9c0cb04 --- diff --git a/manifest b/manifest index 694473c445..f295e2f9f9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\scoverage\stests\sfor\sfts3.c. -D 2010-10-26T07:14:26 +C Add\smissing\sheader\scomments\sfor\schanges\srelated\sto\sthe\sexperimental\ssqlite3_blob_reopen()\sAPI. +D 2010-10-26T11:56:58 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2c8cefd962eca0147132c7cf9eaa4bb24c656f3f F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -176,7 +176,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c 6a5c72fb0e8dc7f6133f5a9d7a747130ef0a00ea F src/shell.c 8517fc1f9c59ae4007e6cc8b9af91ab231ea2056 -F src/sqlite.h.in 460599b35c035deb339d1c9933089ef32187ecc6 +F src/sqlite.h.in 0c3ab42eef59ee80c564be76c700b542ff530758 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqliteInt.h c63b0340dfdfde18ff255ddccf004edd2d073288 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44 @@ -231,7 +231,7 @@ F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2 F src/vdbeInt.h 7f4cf1b2b69bef3a432b1f23dfebef57275436b4 F src/vdbeapi.c 5368714fa750270cf6430160287c21adff44582d F src/vdbeaux.c de0b06b11a25293e820a49159eca9f1c51a64716 -F src/vdbeblob.c e6e485934fcc9201dd1bfd65864be2bb14243b5d +F src/vdbeblob.c c2ed68a4f8b764bbc88d3cdbb06c7c274833ae74 F src/vdbemem.c 23723a12cd3ba7ab3099193094cbb2eb78956aa9 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c b297e8fa656ab5e66244ab15680d68db0adbec30 @@ -877,7 +877,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 918b609290127f54326c638d82837d117398eade -R eb8dee96b23ed044e3e188dc32bc02ca +P 7a2f2864002d4e9a487e2779ae05513880ecb4d1 +R 700e55dce71c563fc39a679df209843f U dan -Z 86656592adbe34ecce7b6ce9cf686881 +Z 667f3356e7b88f02a70759616d0ccab9 diff --git a/manifest.uuid b/manifest.uuid index 633f8d0fd3..4e478589ed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a2f2864002d4e9a487e2779ae05513880ecb4d1 \ No newline at end of file +d1cc5c93f09c9092ec478c04e8d9a8b1f9c0cb04 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 5e32c10c7c..8ff8ab78f7 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4791,7 +4791,25 @@ int sqlite3_blob_open( ); /* -** CAPI3REF: Move a BLOB Handle +** CAPI3REF: Move a BLOB Handle to a New Row +** +** This function is used to move an existing blob handle so that it points +** to a different row of the same database table. The new row is identified +** by the rowid value passed as the second argument. Only the row can be +** changed, the database, table and column on which the blob handle is open +** remain the same. Moving an existing blob handle to a new row can be +** faster than closing the existing handle and opening a new one. +** +** The new row must meet the same criteria as for [sqlite3_blob_open()] - +** it must exist and there must be either a blob or text value stored in +** the nominated column. If the new row is not present in the table, or if +** it does not contain a blob or text value, or if another error occurs, an +** 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. +** +** This function sets the database handle error code and message. */ SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 129aad7363..1bfce65a6d 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",