mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Change sqlite_blob_open() so that it zeros the output pBlob pointer when
it fails. The other sqlite3_blob interfaces accept a NULL pointer as input. (CVS 6622) FossilOrigin-Name: 999d507b4432b518cfc7e02e5b0a2473cf1980f6
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Changes\sto\sthe\strigger.c\smodule\sthat\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6621)
|
C Change\ssqlite_blob_open()\sso\sthat\sit\szeros\sthe\soutput\spBlob\spointer\swhen\nit\sfails.\s\sThe\sother\ssqlite3_blob\sinterfaces\saccept\sa\sNULL\spointer\sas\ninput.\s(CVS\s6622)
|
||||||
D 2009-05-09T00:18:38
|
D 2009-05-09T15:17:47
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -208,7 +208,7 @@ F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a
|
|||||||
F src/vdbeInt.h 43183a2a18654fa570219ab65e53a608057c48ae
|
F src/vdbeInt.h 43183a2a18654fa570219ab65e53a608057c48ae
|
||||||
F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed
|
F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed
|
||||||
F src/vdbeaux.c 1a07329bdf51cc3687f88d9f5b2bd3f1d47cc5a8
|
F src/vdbeaux.c 1a07329bdf51cc3687f88d9f5b2bd3f1d47cc5a8
|
||||||
F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
|
F src/vdbeblob.c 5c5abe9af28316772e7829359f6f9cda2c737ebd
|
||||||
F src/vdbemem.c d8b985eeb88214941380372466a30ca410043a93
|
F src/vdbemem.c d8b985eeb88214941380372466a30ca410043a93
|
||||||
F src/vtab.c 53355aa2381ec3ef2eaad25672cfd5877a02fe45
|
F src/vtab.c 53355aa2381ec3ef2eaad25672cfd5877a02fe45
|
||||||
F src/walker.c 7cdf63223c953d4343c6833e940f110281a378ee
|
F src/walker.c 7cdf63223c953d4343c6833e940f110281a378ee
|
||||||
@@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 254ca3273cfbd833de82296b4859e1ec5535e8be
|
P 567ccc68cc8c73b952a91c71a0e00b08bb25c689
|
||||||
R 29c312f4710fcc89e520e552563a8498
|
R 886144e41731ebf2955c0b2ed8aed044
|
||||||
U drh
|
U drh
|
||||||
Z 4d4c05b89d8d2f3c2da064b74794e76b
|
Z fabb4ba3bc1d6719d08d21dcbbdf7cee
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
567ccc68cc8c73b952a91c71a0e00b08bb25c689
|
999d507b4432b518cfc7e02e5b0a2473cf1980f6
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
**
|
**
|
||||||
** This file contains code used to implement incremental BLOB I/O.
|
** This file contains code used to implement incremental BLOB I/O.
|
||||||
**
|
**
|
||||||
** $Id: vdbeblob.c,v 1.31 2009/03/24 15:08:10 drh Exp $
|
** $Id: vdbeblob.c,v 1.32 2009/05/09 15:17:47 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -85,6 +85,7 @@ int sqlite3_blob_open(
|
|||||||
int rc = SQLITE_OK;
|
int rc = SQLITE_OK;
|
||||||
char zErr[128];
|
char zErr[128];
|
||||||
|
|
||||||
|
*ppBlob = 0;
|
||||||
zErr[0] = 0;
|
zErr[0] = 0;
|
||||||
sqlite3_mutex_enter(db->mutex);
|
sqlite3_mutex_enter(db->mutex);
|
||||||
do {
|
do {
|
||||||
@@ -176,9 +177,10 @@ int sqlite3_blob_open(
|
|||||||
/* Remove either the OP_OpenWrite or OpenRead. Set the P2
|
/* Remove either the OP_OpenWrite or OpenRead. Set the P2
|
||||||
** parameter of the other to pTab->tnum.
|
** parameter of the other to pTab->tnum.
|
||||||
*/
|
*/
|
||||||
sqlite3VdbeChangeToNoop(v, (flags ? 2 : 3), 1);
|
flags = !!flags;
|
||||||
sqlite3VdbeChangeP2(v, (flags ? 3 : 2), pTab->tnum);
|
sqlite3VdbeChangeToNoop(v, 3 - flags, 1);
|
||||||
sqlite3VdbeChangeP3(v, (flags ? 3 : 2), iDb);
|
sqlite3VdbeChangeP2(v, 2 + flags, pTab->tnum);
|
||||||
|
sqlite3VdbeChangeP3(v, 2 + flags, iDb);
|
||||||
|
|
||||||
/* Configure the number of columns. Configure the cursor to
|
/* Configure the number of columns. Configure the cursor to
|
||||||
** think that the table has one more column than it really
|
** think that the table has one more column than it really
|
||||||
@@ -187,7 +189,7 @@ int sqlite3_blob_open(
|
|||||||
** we can invoke OP_Column to fill in the vdbe cursors type
|
** we can invoke OP_Column to fill in the vdbe cursors type
|
||||||
** and offset cache without causing any IO.
|
** and offset cache without causing any IO.
|
||||||
*/
|
*/
|
||||||
sqlite3VdbeChangeP4(v, flags ? 3 : 2, SQLITE_INT_TO_PTR(pTab->nCol+1), P4_INT32);
|
sqlite3VdbeChangeP4(v, 2+flags, SQLITE_INT_TO_PTR(pTab->nCol+1),P4_INT32);
|
||||||
sqlite3VdbeChangeP2(v, 6, pTab->nCol);
|
sqlite3VdbeChangeP2(v, 6, pTab->nCol);
|
||||||
if( !db->mallocFailed ){
|
if( !db->mallocFailed ){
|
||||||
sqlite3VdbeMakeReady(v, 1, 1, 1, 0);
|
sqlite3VdbeMakeReady(v, 1, 1, 1, 0);
|
||||||
@@ -196,7 +198,7 @@ int sqlite3_blob_open(
|
|||||||
|
|
||||||
sqlite3BtreeLeaveAll(db);
|
sqlite3BtreeLeaveAll(db);
|
||||||
rc = sqlite3SafetyOff(db);
|
rc = sqlite3SafetyOff(db);
|
||||||
if( rc!=SQLITE_OK || db->mallocFailed ){
|
if( NEVER(rc!=SQLITE_OK) || db->mallocFailed ){
|
||||||
goto blob_open_out;
|
goto blob_open_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,11 +268,15 @@ int sqlite3_blob_close(sqlite3_blob *pBlob){
|
|||||||
int rc;
|
int rc;
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
|
|
||||||
db = p->db;
|
if( p ){
|
||||||
sqlite3_mutex_enter(db->mutex);
|
db = p->db;
|
||||||
rc = sqlite3_finalize(p->pStmt);
|
sqlite3_mutex_enter(db->mutex);
|
||||||
sqlite3DbFree(db, p);
|
rc = sqlite3_finalize(p->pStmt);
|
||||||
sqlite3_mutex_leave(db->mutex);
|
sqlite3DbFree(db, p);
|
||||||
|
sqlite3_mutex_leave(db->mutex);
|
||||||
|
}else{
|
||||||
|
rc = SQLITE_OK;
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,8 +293,10 @@ static int blobReadWrite(
|
|||||||
int rc;
|
int rc;
|
||||||
Incrblob *p = (Incrblob *)pBlob;
|
Incrblob *p = (Incrblob *)pBlob;
|
||||||
Vdbe *v;
|
Vdbe *v;
|
||||||
sqlite3 *db = p->db;
|
sqlite3 *db;
|
||||||
|
|
||||||
|
if( p==0 ) return SQLITE_MISUSE;
|
||||||
|
db = p->db;
|
||||||
sqlite3_mutex_enter(db->mutex);
|
sqlite3_mutex_enter(db->mutex);
|
||||||
v = (Vdbe*)p->pStmt;
|
v = (Vdbe*)p->pStmt;
|
||||||
|
|
||||||
@@ -344,7 +352,7 @@ int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
|
|||||||
*/
|
*/
|
||||||
int sqlite3_blob_bytes(sqlite3_blob *pBlob){
|
int sqlite3_blob_bytes(sqlite3_blob *pBlob){
|
||||||
Incrblob *p = (Incrblob *)pBlob;
|
Incrblob *p = (Incrblob *)pBlob;
|
||||||
return p->nByte;
|
return p ? p->nByte : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* #ifndef SQLITE_OMIT_INCRBLOB */
|
#endif /* #ifndef SQLITE_OMIT_INCRBLOB */
|
||||||
|
|||||||
Reference in New Issue
Block a user