mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Fix an uninitialized variable. The variable was harmless, but pedantic
error checking in MSVC raised an exception on it. (CVS 1651) FossilOrigin-Name: afc398c2ca97ff165ea8242a5ffb8b6374b7fa8f
This commit is contained in:
32
manifest
32
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Remove\sunused\sOP_UtfXX\sopcodes.\s(CVS\s1650)
|
C Fix\san\suninitialized\svariable.\s\sThe\svariable\swas\sharmless,\sbut\spedantic\nerror\schecking\sin\sMSVC\sraised\san\sexception\son\sit.\s(CVS\s1651)
|
||||||
D 2004-06-21T11:30:56
|
D 2004-06-21T18:14:46
|
||||||
F Makefile.in d69d53c543518c1572ee0a8e8723d7e00bdb2266
|
F Makefile.in d69d53c543518c1572ee0a8e8723d7e00bdb2266
|
||||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -28,9 +28,9 @@ F src/attach.c 05102e2e8ac43ce639d07b47a99c7772a62420e6
|
|||||||
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
|
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
|
||||||
F src/btree.c 0cf8a52a57a7eb13d50719114ee1fa353e89d7d3
|
F src/btree.c 0cf8a52a57a7eb13d50719114ee1fa353e89d7d3
|
||||||
F src/btree.h 32f96abef464cf8765b23ca669acfe90d191fcc5
|
F src/btree.h 32f96abef464cf8765b23ca669acfe90d191fcc5
|
||||||
F src/build.c ffcd0cd8cd8aac1a45d852c6364c6b5b07cd9dc4
|
F src/build.c ee7548a4dfc446d4312c217d74badbd2898a7eef
|
||||||
F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1
|
F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1
|
||||||
F src/delete.c 19287dd204569519636a04eca2b66c49c26e9266
|
F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3
|
||||||
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
||||||
F src/expr.c a0372aa8d27ce9a82f6419c066b47f0500ec50a6
|
F src/expr.c a0372aa8d27ce9a82f6419c066b47f0500ec50a6
|
||||||
F src/func.c 3d32878eeb4c6a9977c72ec19984d329b6954c7e
|
F src/func.c 3d32878eeb4c6a9977c72ec19984d329b6954c7e
|
||||||
@@ -44,11 +44,11 @@ F src/os.h 1cb5f0293a30288451fe3c0c73815cf208212ed1
|
|||||||
F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8
|
F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8
|
||||||
F src/os_mac.c 3d31e26be1411acfb7961033098631b4f3486fdf
|
F src/os_mac.c 3d31e26be1411acfb7961033098631b4f3486fdf
|
||||||
F src/os_mac.h 51d2445f47e182ed32d3bd6937f81070c6fd9bd4
|
F src/os_mac.h 51d2445f47e182ed32d3bd6937f81070c6fd9bd4
|
||||||
F src/os_unix.c 47176c8e9b90ba751b2c110b6384936572ff3abc
|
F src/os_unix.c 3d3553d71cbf1430a40985a7581ca27b85723ee1
|
||||||
F src/os_unix.h 1cd6133cf66dea704b8646b70b2dfdcbdd9b3738
|
F src/os_unix.h 00c1f82b526ab2fb7ee5ddd555ea4ed68363c93a
|
||||||
F src/os_win.c 337e973ee77797aaab4787e3477a5945fcd97266
|
F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96
|
||||||
F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
|
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
|
||||||
F src/pager.c d627c5e46084b0c757a16cec2c17adcc8046f8ee
|
F src/pager.c f42526a134d56f5ee4b4217211dd36b3c8f00963
|
||||||
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
|
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
|
||||||
F src/parse.y 097438674976355a10cf177bd97326c548820b86
|
F src/parse.y 097438674976355a10cf177bd97326c548820b86
|
||||||
F src/pragma.c 0750e1c360647dbe0a991f16133b0fe5e42e5039
|
F src/pragma.c 0750e1c360647dbe0a991f16133b0fe5e42e5039
|
||||||
@@ -61,7 +61,7 @@ F src/sqliteInt.h b379bc549c9d812090d6c33ff5f229b34346ac0c
|
|||||||
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
|
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
|
||||||
F src/tclsqlite.c 8d093146332b2f0cbf2a8ebe8597d481619308a3
|
F src/tclsqlite.c 8d093146332b2f0cbf2a8ebe8597d481619308a3
|
||||||
F src/test1.c ee426e026ad9223483e7a84bb68849fc6e9f542e
|
F src/test1.c ee426e026ad9223483e7a84bb68849fc6e9f542e
|
||||||
F src/test2.c db0a0c30b59f1639cb8c2572be06439402833cc8
|
F src/test2.c dafd8bd314a554bf376c6d3a8c83fd69219f5a40
|
||||||
F src/test3.c 7247090d15a5a43823079b6fd8dad1ed3cccdedf
|
F src/test3.c 7247090d15a5a43823079b6fd8dad1ed3cccdedf
|
||||||
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
|
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
|
||||||
F src/test5.c 1b7c275b2929dbd034a567255d2aca339410d1d6
|
F src/test5.c 1b7c275b2929dbd034a567255d2aca339410d1d6
|
||||||
@@ -75,12 +75,12 @@ F src/vdbe.c 5da73f61016b1874d935b522bab6ca8b5aa15216
|
|||||||
F src/vdbe.h 2d87155e31e84bb00cdc48cc1ce6987a3a484250
|
F src/vdbe.h 2d87155e31e84bb00cdc48cc1ce6987a3a484250
|
||||||
F src/vdbeInt.h c0740932621a8d4aac20e0c4235ce44eb5e8dce6
|
F src/vdbeInt.h c0740932621a8d4aac20e0c4235ce44eb5e8dce6
|
||||||
F src/vdbeapi.c 8a9421341e09b506a934132c9015f26362ae8c0e
|
F src/vdbeapi.c 8a9421341e09b506a934132c9015f26362ae8c0e
|
||||||
F src/vdbeaux.c b89e05d8a1be4a27ba98c0ae369642c12a2cb44f
|
F src/vdbeaux.c bf1f5a48b4d2f4f0ee6e5f00dca491855e81cd02
|
||||||
F src/vdbemem.c 9359c53386e070fea9f5403cab0c6f0cfe36496b
|
F src/vdbemem.c 9359c53386e070fea9f5403cab0c6f0cfe36496b
|
||||||
F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
|
F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
|
||||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||||
F test/attach.test 3acdffccbf5f78b07746771b9490758718e28856
|
F test/attach.test 3acdffccbf5f78b07746771b9490758718e28856
|
||||||
F test/attach2.test 4462c2e652e3d3ac2a9c86d08eebcd648038ae7d
|
F test/attach2.test 3cd1d4a69e0ec307d0b68a44a96c9c8e1e253d65
|
||||||
F test/attach3.test c4cc0b806783ce3d860af6b80c947f93ffb14270
|
F test/attach3.test c4cc0b806783ce3d860af6b80c947f93ffb14270
|
||||||
F test/auth.test a211eab0542ec024b578d771b09242dd9bb1aba3
|
F test/auth.test a211eab0542ec024b578d771b09242dd9bb1aba3
|
||||||
F test/bigfile.test a1101b46528ad7282fb9b323d25da18672a3bd0a
|
F test/bigfile.test a1101b46528ad7282fb9b323d25da18672a3bd0a
|
||||||
@@ -225,7 +225,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
|
|||||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||||
F www/version3.tcl af528563442e3039928f9018327a18157e53a44f
|
F www/version3.tcl af528563442e3039928f9018327a18157e53a44f
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 4d02df63496091a1e643601f84313f42130d6282
|
P 84d6354fce8332b2fb4365ee23b9c9b7c012db9f
|
||||||
R a5c7b81b886ce0dc51fd23c906f18801
|
R cb4496210314b23d636b73b949f5346a
|
||||||
U danielk1977
|
U drh
|
||||||
Z 7e03b6c5873537e5aac7ef83e2a8f46a
|
Z f5c808fd6c82bca1e41b10c166ff7e8f
|
||||||
|
@@ -1 +1 @@
|
|||||||
84d6354fce8332b2fb4365ee23b9c9b7c012db9f
|
afc398c2ca97ff165ea8242a5ffb8b6374b7fa8f
|
55
src/build.c
55
src/build.c
@@ -23,7 +23,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** PRAGMA
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.229 2004/06/21 10:45:07 danielk1977 Exp $
|
** $Id: build.c,v 1.230 2004/06/21 18:14:46 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -991,37 +991,19 @@ static void callCollNeeded(sqlite *db, const char *zName, int nName){
|
|||||||
** possible.
|
** possible.
|
||||||
*/
|
*/
|
||||||
static int synthCollSeq(Parse *pParse, CollSeq *pColl){
|
static int synthCollSeq(Parse *pParse, CollSeq *pColl){
|
||||||
CollSeq *pColl2 = 0;
|
CollSeq *pColl2;
|
||||||
char *z = pColl->zName;
|
char *z = pColl->zName;
|
||||||
int n = strlen(z);
|
int n = strlen(z);
|
||||||
switch( pParse->db->enc ){
|
sqlite *db = pParse->db;
|
||||||
case SQLITE_UTF16LE:
|
int i;
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db, SQLITE_UTF16BE, z, n, 0);
|
static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };
|
||||||
assert( pColl2 );
|
for(i=0; i<3; i++){
|
||||||
if( pColl2->xCmp ) break;
|
pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, n, 0);
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db, SQLITE_UTF8, z, n, 0);
|
if( pColl2->xCmp!=0 ){
|
||||||
assert( pColl2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQLITE_UTF16BE:
|
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16LE, z, n, 0);
|
|
||||||
assert( pColl2 );
|
|
||||||
if( pColl2->xCmp ) break;
|
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF8, z, n, 0);
|
|
||||||
assert( pColl2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQLITE_UTF8:
|
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16BE, z, n, 0);
|
|
||||||
assert( pColl2 );
|
|
||||||
if( pColl2->xCmp ) break;
|
|
||||||
pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16LE, z, n, 0);
|
|
||||||
assert( pColl2 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( pColl2->xCmp ){
|
|
||||||
memcpy(pColl, pColl2, sizeof(CollSeq));
|
memcpy(pColl, pColl2, sizeof(CollSeq));
|
||||||
}else{
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( pParse->nErr==0 ){
|
if( pParse->nErr==0 ){
|
||||||
sqlite3SetNString(&pParse->zErrMsg, "no such collation sequence: ",
|
sqlite3SetNString(&pParse->zErrMsg, "no such collation sequence: ",
|
||||||
-1, z, n, 0);
|
-1, z, n, 0);
|
||||||
@@ -1029,8 +1011,6 @@ static int synthCollSeq(Parse *pParse, CollSeq *pColl){
|
|||||||
pParse->nErr++;
|
pParse->nErr++;
|
||||||
return SQLITE_ERROR;
|
return SQLITE_ERROR;
|
||||||
}
|
}
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This routine is called on a collation sequence before it is used to
|
** This routine is called on a collation sequence before it is used to
|
||||||
@@ -1056,6 +1036,11 @@ int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
|
|||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Call sqlite3CheckCollSeq() for all collating sequences in an index,
|
||||||
|
** in order to verify that all the necessary collating sequences are
|
||||||
|
** loaded.
|
||||||
|
*/
|
||||||
int sqlite3CheckIndexCollSeq(Parse *pParse, Index *pIdx){
|
int sqlite3CheckIndexCollSeq(Parse *pParse, Index *pIdx){
|
||||||
if( pIdx ){
|
if( pIdx ){
|
||||||
int i;
|
int i;
|
||||||
@@ -1124,7 +1109,7 @@ char sqlite3AffinityType(const char *zType, int nType){
|
|||||||
int n, i;
|
int n, i;
|
||||||
struct {
|
struct {
|
||||||
const char *zSub; /* Keywords substring to search for */
|
const char *zSub; /* Keywords substring to search for */
|
||||||
int nSub; /* length of zSub */
|
char nSub; /* length of zSub */
|
||||||
char affinity; /* Affinity to return if it matches */
|
char affinity; /* Affinity to return if it matches */
|
||||||
} substrings[] = {
|
} substrings[] = {
|
||||||
{"INT", 3, SQLITE_AFF_INTEGER},
|
{"INT", 3, SQLITE_AFF_INTEGER},
|
||||||
@@ -1295,12 +1280,6 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){
|
|||||||
|
|
||||||
assert( !db->init.busy || !pSelect );
|
assert( !db->init.busy || !pSelect );
|
||||||
|
|
||||||
/* If the table is generated from a SELECT, then construct the
|
|
||||||
** list of columns and the text of the table.
|
|
||||||
*/
|
|
||||||
if( pSelect ){
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the db->init.busy is 1 it means we are reading the SQL off the
|
/* If the db->init.busy is 1 it means we are reading the SQL off the
|
||||||
** "sqlite_master" or "sqlite_temp_master" table on the disk.
|
** "sqlite_master" or "sqlite_temp_master" table on the disk.
|
||||||
** So do not write to the disk again. Extract the root page number
|
** So do not write to the disk again. Extract the root page number
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle DELETE FROM statements.
|
** to handle DELETE FROM statements.
|
||||||
**
|
**
|
||||||
** $Id: delete.c,v 1.76 2004/06/21 06:50:27 danielk1977 Exp $
|
** $Id: delete.c,v 1.77 2004/06/21 18:14:47 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
|
@@ -341,6 +341,7 @@ int sqlite3OsOpenReadWrite(
|
|||||||
int *pReadonly
|
int *pReadonly
|
||||||
){
|
){
|
||||||
int rc;
|
int rc;
|
||||||
|
assert( !id->isOpen );
|
||||||
id->dirfd = -1;
|
id->dirfd = -1;
|
||||||
id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
|
id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
|
||||||
if( id->h<0 ){
|
if( id->h<0 ){
|
||||||
@@ -360,6 +361,7 @@ int sqlite3OsOpenReadWrite(
|
|||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
id->locktype = 0;
|
id->locktype = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
TRACE3("OPEN %-3d %s\n", id->h, zFilename);
|
TRACE3("OPEN %-3d %s\n", id->h, zFilename);
|
||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -382,6 +384,7 @@ int sqlite3OsOpenReadWrite(
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
||||||
int rc;
|
int rc;
|
||||||
|
assert( !id->isOpen );
|
||||||
if( access(zFilename, 0)==0 ){
|
if( access(zFilename, 0)==0 ){
|
||||||
return SQLITE_CANTOPEN;
|
return SQLITE_CANTOPEN;
|
||||||
}
|
}
|
||||||
@@ -400,6 +403,7 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
|||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
id->locktype = 0;
|
id->locktype = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
if( delFlag ){
|
if( delFlag ){
|
||||||
unlink(zFilename);
|
unlink(zFilename);
|
||||||
}
|
}
|
||||||
@@ -417,6 +421,7 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
||||||
int rc;
|
int rc;
|
||||||
|
assert( !id->isOpen );
|
||||||
id->dirfd = -1;
|
id->dirfd = -1;
|
||||||
id->h = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
|
id->h = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
|
||||||
if( id->h<0 ){
|
if( id->h<0 ){
|
||||||
@@ -430,6 +435,7 @@ int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
|||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
id->locktype = 0;
|
id->locktype = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
TRACE3("OPEN-RO %-3d %s\n", id->h, zFilename);
|
TRACE3("OPEN-RO %-3d %s\n", id->h, zFilename);
|
||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -455,7 +461,7 @@ int sqlite3OsOpenDirectory(
|
|||||||
const char *zDirname,
|
const char *zDirname,
|
||||||
OsFile *id
|
OsFile *id
|
||||||
){
|
){
|
||||||
if( id->h<0 ){
|
if( !id->isOpen ){
|
||||||
/* Do not open the directory if the corresponding file is not already
|
/* Do not open the directory if the corresponding file is not already
|
||||||
** open. */
|
** open. */
|
||||||
return SQLITE_CANTOPEN;
|
return SQLITE_CANTOPEN;
|
||||||
@@ -510,6 +516,7 @@ int sqlite3OsTempFileName(char *zBuf){
|
|||||||
** Close a file.
|
** Close a file.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsClose(OsFile *id){
|
int sqlite3OsClose(OsFile *id){
|
||||||
|
if( !id->isOpen ) return SQLITE_OK;
|
||||||
sqlite3OsUnlock(id, NO_LOCK);
|
sqlite3OsUnlock(id, NO_LOCK);
|
||||||
if( id->dirfd>=0 ) close(id->dirfd);
|
if( id->dirfd>=0 ) close(id->dirfd);
|
||||||
id->dirfd = -1;
|
id->dirfd = -1;
|
||||||
@@ -537,6 +544,7 @@ int sqlite3OsClose(OsFile *id){
|
|||||||
releaseLockInfo(id->pLock);
|
releaseLockInfo(id->pLock);
|
||||||
releaseOpenCnt(id->pOpen);
|
releaseOpenCnt(id->pOpen);
|
||||||
sqlite3OsLeaveMutex();
|
sqlite3OsLeaveMutex();
|
||||||
|
id->isOpen = 0;
|
||||||
TRACE2("CLOSE %-3d\n", id->h);
|
TRACE2("CLOSE %-3d\n", id->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -549,6 +557,7 @@ int sqlite3OsClose(OsFile *id){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
||||||
int got;
|
int got;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
TIMER_START;
|
TIMER_START;
|
||||||
got = read(id->h, pBuf, amt);
|
got = read(id->h, pBuf, amt);
|
||||||
@@ -569,6 +578,7 @@ int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
||||||
int wrote = 0;
|
int wrote = 0;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
TIMER_START;
|
TIMER_START;
|
||||||
while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){
|
while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){
|
||||||
@@ -588,6 +598,7 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
|||||||
** Move the read/write pointer in a file.
|
** Move the read/write pointer in a file.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSeek(OsFile *id, off_t offset){
|
int sqlite3OsSeek(OsFile *id, off_t offset){
|
||||||
|
assert( id->isOpen );
|
||||||
SEEK(offset/1024 + 1);
|
SEEK(offset/1024 + 1);
|
||||||
lseek(id->h, offset, SEEK_SET);
|
lseek(id->h, offset, SEEK_SET);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -605,6 +616,7 @@ int sqlite3OsSeek(OsFile *id, off_t offset){
|
|||||||
** will not roll back - possibly leading to database corruption.
|
** will not roll back - possibly leading to database corruption.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSync(OsFile *id){
|
int sqlite3OsSync(OsFile *id){
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
TRACE2("SYNC %-3d\n", id->h);
|
TRACE2("SYNC %-3d\n", id->h);
|
||||||
if( fsync(id->h) ){
|
if( fsync(id->h) ){
|
||||||
@@ -641,6 +653,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
|
|||||||
** Truncate an open file to a specified size
|
** Truncate an open file to a specified size
|
||||||
*/
|
*/
|
||||||
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
return ftruncate(id->h, nByte)==0 ? SQLITE_OK : SQLITE_IOERR;
|
return ftruncate(id->h, nByte)==0 ? SQLITE_OK : SQLITE_IOERR;
|
||||||
}
|
}
|
||||||
@@ -650,6 +663,7 @@ int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
if( fstat(id->h, &buf)!=0 ){
|
if( fstat(id->h, &buf)!=0 ){
|
||||||
return SQLITE_IOERR;
|
return SQLITE_IOERR;
|
||||||
@@ -667,6 +681,7 @@ int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
|||||||
int sqlite3OsCheckReservedLock(OsFile *id){
|
int sqlite3OsCheckReservedLock(OsFile *id){
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
|
assert( id->isOpen );
|
||||||
sqlite3OsEnterMutex(); /* Needed because id->pLock is shared across threads */
|
sqlite3OsEnterMutex(); /* Needed because id->pLock is shared across threads */
|
||||||
|
|
||||||
/* Check if a thread in this process holds such a lock */
|
/* Check if a thread in this process holds such a lock */
|
||||||
@@ -724,6 +739,7 @@ int sqlite3OsLock(OsFile *id, int locktype){
|
|||||||
struct flock lock;
|
struct flock lock;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
|
assert( id->isOpen );
|
||||||
TRACE6("LOCK %d %d was %d(%d,%d)\n",
|
TRACE6("LOCK %d %d was %d(%d,%d)\n",
|
||||||
id->h, locktype, id->locktype, pLock->locktype, pLock->cnt);
|
id->h, locktype, id->locktype, pLock->locktype, pLock->cnt);
|
||||||
|
|
||||||
@@ -869,6 +885,7 @@ int sqlite3OsUnlock(OsFile *id, int locktype){
|
|||||||
struct lockInfo *pLock;
|
struct lockInfo *pLock;
|
||||||
struct flock lock;
|
struct flock lock;
|
||||||
|
|
||||||
|
assert( id->isOpen );
|
||||||
TRACE6("UNLOCK %d %d was %d(%d,%d)\n",
|
TRACE6("UNLOCK %d %d was %d(%d,%d)\n",
|
||||||
id->h, locktype, id->locktype, id->pLock->locktype, id->pLock->cnt);
|
id->h, locktype, id->locktype, id->pLock->locktype, id->pLock->cnt);
|
||||||
|
|
||||||
|
@@ -65,7 +65,8 @@ struct OsFile {
|
|||||||
struct openCnt *pOpen; /* Info about all open fd's on this inode */
|
struct openCnt *pOpen; /* Info about all open fd's on this inode */
|
||||||
struct lockInfo *pLock; /* Info about locks on this inode */
|
struct lockInfo *pLock; /* Info about locks on this inode */
|
||||||
int h; /* The file descriptor */
|
int h; /* The file descriptor */
|
||||||
int locktype; /* The type of lock held on this fd */
|
unsigned char locktype; /* The type of lock held on this fd */
|
||||||
|
unsigned char isOpen; /* True if needs to be closed */
|
||||||
int dirfd; /* File descriptor for the directory */
|
int dirfd; /* File descriptor for the directory */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
24
src/os_win.c
24
src/os_win.c
@@ -64,7 +64,9 @@ int sqlite3OsOpenReadWrite(
|
|||||||
OsFile *id,
|
OsFile *id,
|
||||||
int *pReadonly
|
int *pReadonly
|
||||||
){
|
){
|
||||||
HANDLE h = CreateFile(zFilename,
|
HANDLE h;
|
||||||
|
assert( !id->isOpen );
|
||||||
|
h = CreateFile(zFilename,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -91,6 +93,7 @@ int sqlite3OsOpenReadWrite(
|
|||||||
id->h = h;
|
id->h = h;
|
||||||
id->locktype = NO_LOCK;
|
id->locktype = NO_LOCK;
|
||||||
id->sharedLockByte = 0;
|
id->sharedLockByte = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
TRACE3("OPEN R/W %d \"%s\"\n", h, zFilename);
|
TRACE3("OPEN R/W %d \"%s\"\n", h, zFilename);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -114,6 +117,7 @@ int sqlite3OsOpenReadWrite(
|
|||||||
int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
int fileflags;
|
int fileflags;
|
||||||
|
assert( !id->isOpen );
|
||||||
if( delFlag ){
|
if( delFlag ){
|
||||||
fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS
|
fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS
|
||||||
| FILE_FLAG_DELETE_ON_CLOSE;
|
| FILE_FLAG_DELETE_ON_CLOSE;
|
||||||
@@ -134,6 +138,7 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
|||||||
id->h = h;
|
id->h = h;
|
||||||
id->locktype = NO_LOCK;
|
id->locktype = NO_LOCK;
|
||||||
id->sharedLockByte = 0;
|
id->sharedLockByte = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
TRACE3("OPEN EX %d \"%s\"\n", h, zFilename);
|
TRACE3("OPEN EX %d \"%s\"\n", h, zFilename);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -147,7 +152,9 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
|
|||||||
** On failure, return SQLITE_CANTOPEN.
|
** On failure, return SQLITE_CANTOPEN.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
||||||
HANDLE h = CreateFile(zFilename,
|
HANDLE h;
|
||||||
|
assert( !id->isOpen );
|
||||||
|
h = CreateFile(zFilename,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -161,6 +168,7 @@ int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
|||||||
id->h = h;
|
id->h = h;
|
||||||
id->locktype = NO_LOCK;
|
id->locktype = NO_LOCK;
|
||||||
id->sharedLockByte = 0;
|
id->sharedLockByte = 0;
|
||||||
|
id->isOpen = 1;
|
||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
TRACE3("OPEN RO %d \"%s\"\n", h, zFilename);
|
TRACE3("OPEN RO %d \"%s\"\n", h, zFilename);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -221,9 +229,12 @@ int sqlite3OsTempFileName(char *zBuf){
|
|||||||
** Close a file.
|
** Close a file.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsClose(OsFile *id){
|
int sqlite3OsClose(OsFile *id){
|
||||||
|
if( id->isOpen ){
|
||||||
TRACE2("CLOSE %d\n", id->h);
|
TRACE2("CLOSE %d\n", id->h);
|
||||||
CloseHandle(id->h);
|
CloseHandle(id->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
|
id->isOpen = 0;
|
||||||
|
}
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,6 +245,7 @@ int sqlite3OsClose(OsFile *id){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
||||||
DWORD got;
|
DWORD got;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
TRACE3("READ %d lock=%d\n", id->h, id->locktype);
|
TRACE3("READ %d lock=%d\n", id->h, id->locktype);
|
||||||
if( !ReadFile(id->h, pBuf, amt, &got, 0) ){
|
if( !ReadFile(id->h, pBuf, amt, &got, 0) ){
|
||||||
@@ -253,6 +265,7 @@ int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
|||||||
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
||||||
int rc;
|
int rc;
|
||||||
DWORD wrote;
|
DWORD wrote;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
TRACE3("WRITE %d lock=%d\n", id->h, id->locktype);
|
TRACE3("WRITE %d lock=%d\n", id->h, id->locktype);
|
||||||
while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, &wrote, 0))!=0 && wrote>0 ){
|
while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, &wrote, 0))!=0 && wrote>0 ){
|
||||||
@@ -272,6 +285,7 @@ int sqlite3OsSeek(OsFile *id, off_t offset){
|
|||||||
LONG upperBits = offset>>32;
|
LONG upperBits = offset>>32;
|
||||||
LONG lowerBits = offset & 0xffffffff;
|
LONG lowerBits = offset & 0xffffffff;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
|
assert( id->isOpen );
|
||||||
SEEK(offset/1024 + 1);
|
SEEK(offset/1024 + 1);
|
||||||
rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN);
|
rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN);
|
||||||
TRACE3("SEEK %d %lld\n", id->h, offset);
|
TRACE3("SEEK %d %lld\n", id->h, offset);
|
||||||
@@ -282,6 +296,7 @@ int sqlite3OsSeek(OsFile *id, off_t offset){
|
|||||||
** Make sure all writes to a particular file are committed to disk.
|
** Make sure all writes to a particular file are committed to disk.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSync(OsFile *id){
|
int sqlite3OsSync(OsFile *id){
|
||||||
|
assert( id->isOpen );
|
||||||
TRACE3("SYNC %d lock=%d\n", id->h, id->locktype);
|
TRACE3("SYNC %d lock=%d\n", id->h, id->locktype);
|
||||||
if( FlushFileBuffers(id->h) ){
|
if( FlushFileBuffers(id->h) ){
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -304,6 +319,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
||||||
LONG upperBits = nByte>>32;
|
LONG upperBits = nByte>>32;
|
||||||
|
assert( id->isOpen );
|
||||||
TRACE3("TRUNCATE %d %lld\n", id->h, nByte);
|
TRACE3("TRUNCATE %d %lld\n", id->h, nByte);
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
SetFilePointer(id->h, nByte, &upperBits, FILE_BEGIN);
|
SetFilePointer(id->h, nByte, &upperBits, FILE_BEGIN);
|
||||||
@@ -316,6 +332,7 @@ int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
||||||
DWORD upperBits, lowerBits;
|
DWORD upperBits, lowerBits;
|
||||||
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
lowerBits = GetFileSize(id->h, &upperBits);
|
lowerBits = GetFileSize(id->h, &upperBits);
|
||||||
*pSize = (((off_t)upperBits)<<32) + lowerBits;
|
*pSize = (((off_t)upperBits)<<32) + lowerBits;
|
||||||
@@ -408,6 +425,7 @@ int sqlite3OsLock(OsFile *id, int locktype){
|
|||||||
int newLocktype; /* Set id->locktype to this value before exiting */
|
int newLocktype; /* Set id->locktype to this value before exiting */
|
||||||
int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
|
int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
|
||||||
|
|
||||||
|
assert( id->isOpen );
|
||||||
TRACE5("LOCK %d %d was %d(%d)\n",
|
TRACE5("LOCK %d %d was %d(%d)\n",
|
||||||
id->h, locktype, id->locktype, id->sharedLockByte);
|
id->h, locktype, id->locktype, id->sharedLockByte);
|
||||||
|
|
||||||
@@ -520,6 +538,7 @@ int sqlite3OsLock(OsFile *id, int locktype){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsCheckReservedLock(OsFile *id){
|
int sqlite3OsCheckReservedLock(OsFile *id){
|
||||||
int rc;
|
int rc;
|
||||||
|
assert( id->isOpen );
|
||||||
if( id->locktype>=RESERVED_LOCK ){
|
if( id->locktype>=RESERVED_LOCK ){
|
||||||
rc = 1;
|
rc = 1;
|
||||||
TRACE3("TEST WR-LOCK %d %d (local)\n", id->h, rc);
|
TRACE3("TEST WR-LOCK %d %d (local)\n", id->h, rc);
|
||||||
@@ -545,6 +564,7 @@ int sqlite3OsCheckReservedLock(OsFile *id){
|
|||||||
*/
|
*/
|
||||||
int sqlite3OsUnlock(OsFile *id, int locktype){
|
int sqlite3OsUnlock(OsFile *id, int locktype){
|
||||||
int rc, type;
|
int rc, type;
|
||||||
|
assert( id->isOpen );
|
||||||
assert( locktype<=SHARED_LOCK );
|
assert( locktype<=SHARED_LOCK );
|
||||||
TRACE5("UNLOCK %d to %d was %d(%d)\n", id->h, locktype,
|
TRACE5("UNLOCK %d to %d was %d(%d)\n", id->h, locktype,
|
||||||
id->locktype, id->sharedLockByte);
|
id->locktype, id->sharedLockByte);
|
||||||
|
@@ -38,8 +38,9 @@
|
|||||||
typedef struct OsFile OsFile;
|
typedef struct OsFile OsFile;
|
||||||
struct OsFile {
|
struct OsFile {
|
||||||
HANDLE h; /* Handle for accessing the file */
|
HANDLE h; /* Handle for accessing the file */
|
||||||
int locktype; /* Type of lock currently held on this file */
|
unsigned char locktype; /* Type of lock currently held on this file */
|
||||||
int sharedLockByte; /* Randomly chosen byte used as a shared lock */
|
unsigned char isOpen; /* True if needs to be closed */
|
||||||
|
short sharedLockByte; /* Randomly chosen byte used as a shared lock */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
18
src/pager.c
18
src/pager.c
@@ -18,7 +18,7 @@
|
|||||||
** file simultaneously, or one process from reading the database while
|
** file simultaneously, or one process from reading the database while
|
||||||
** another is writing.
|
** another is writing.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.c,v 1.132 2004/06/18 23:21:47 dougcurrie Exp $
|
** @(#) $Id: pager.c,v 1.133 2004/06/21 18:14:47 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
#include "os.h" /* Must be first to enable large file support */
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -613,6 +613,7 @@ static int pager_delmaster(const char *zMaster){
|
|||||||
/* Open the master journal file exclusively in case some other process
|
/* Open the master journal file exclusively in case some other process
|
||||||
** is running this routine also. Not that it makes too much difference.
|
** is running this routine also. Not that it makes too much difference.
|
||||||
*/
|
*/
|
||||||
|
memset(&master, 0, sizeof(master));
|
||||||
rc = sqlite3OsOpenExclusive(zMaster, &master, 0);
|
rc = sqlite3OsOpenExclusive(zMaster, &master, 0);
|
||||||
if( rc!=SQLITE_OK ) goto delmaster_out;
|
if( rc!=SQLITE_OK ) goto delmaster_out;
|
||||||
master_open = 1;
|
master_open = 1;
|
||||||
@@ -652,6 +653,7 @@ static int pager_delmaster(const char *zMaster){
|
|||||||
int nMaster;
|
int nMaster;
|
||||||
off_t jsz;
|
off_t jsz;
|
||||||
|
|
||||||
|
memset(&journal, 0, sizeof(journal));
|
||||||
rc = sqlite3OsOpenReadOnly(zJournal, &journal);
|
rc = sqlite3OsOpenReadOnly(zJournal, &journal);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
sqlite3OsClose(&journal);
|
sqlite3OsClose(&journal);
|
||||||
@@ -1095,14 +1097,14 @@ int sqlite3pager_open(
|
|||||||
char zTemp[SQLITE_TEMPNAME_SIZE];
|
char zTemp[SQLITE_TEMPNAME_SIZE];
|
||||||
|
|
||||||
*ppPager = 0;
|
*ppPager = 0;
|
||||||
|
memset(&fd, 0, sizeof(fd));
|
||||||
if( sqlite3_malloc_failed ){
|
if( sqlite3_malloc_failed ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
if( zFilename && zFilename[0] ){
|
if( zFilename && zFilename[0] ){
|
||||||
if( strcmp(zFilename,":memory:")==0 ){
|
if( strcmp(zFilename,":memory:")==0 ){
|
||||||
memDb = 1;
|
memDb = 1;
|
||||||
zFullPathname = sqliteMalloc(4);
|
zFullPathname = sqliteStrDup("");
|
||||||
if( zFullPathname ) strcpy(zFullPathname, "");
|
|
||||||
rc = SQLITE_OK;
|
rc = SQLITE_OK;
|
||||||
}else{
|
}else{
|
||||||
zFullPathname = sqlite3OsFullPathname(zFilename);
|
zFullPathname = sqlite3OsFullPathname(zFilename);
|
||||||
@@ -1122,15 +1124,15 @@ int sqlite3pager_open(
|
|||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
if( tempFile ) sqlite3OsClose(&fd);
|
sqlite3OsClose(&fd);
|
||||||
if( zFullPathname ) sqliteFree(zFullPathname);
|
sqliteFree(zFullPathname);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
nameLen = strlen(zFullPathname);
|
nameLen = strlen(zFullPathname);
|
||||||
pPager = sqliteMalloc( sizeof(*pPager) + nameLen*3 + 30 );
|
pPager = sqliteMalloc( sizeof(*pPager) + nameLen*3 + 30 );
|
||||||
if( pPager==0 ){
|
if( pPager==0 ){
|
||||||
if( tempFile ) sqlite3OsClose(&fd);
|
sqlite3OsClose(&fd);
|
||||||
if( zFullPathname ) sqliteFree(zFullPathname);
|
sqliteFree(zFullPathname);
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
SET_PAGER(pPager);
|
SET_PAGER(pPager);
|
||||||
@@ -1371,9 +1373,7 @@ int sqlite3pager_close(Pager *pPager){
|
|||||||
pNext = pPg->pNextAll;
|
pNext = pPg->pNextAll;
|
||||||
sqliteFree(pPg);
|
sqliteFree(pPg);
|
||||||
}
|
}
|
||||||
if( !pPager->memDb ){
|
|
||||||
sqlite3OsClose(&pPager->fd);
|
sqlite3OsClose(&pPager->fd);
|
||||||
}
|
|
||||||
assert( pPager->journalOpen==0 );
|
assert( pPager->journalOpen==0 );
|
||||||
/* Temp files are automatically deleted by the OS
|
/* Temp files are automatically deleted by the OS
|
||||||
** if( pPager->tempFile ){
|
** if( pPager->tempFile ){
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** testing of the SQLite library.
|
||||||
**
|
**
|
||||||
** $Id: test2.c,v 1.22 2004/06/15 11:40:09 danielk1977 Exp $
|
** $Id: test2.c,v 1.23 2004/06/21 18:14:47 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -499,6 +499,7 @@ static int fake_big_file(
|
|||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
|
if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
|
||||||
|
memset(&fd, 0, sizeof(fd));
|
||||||
rc = sqlite3OsOpenReadWrite(argv[2], &fd, &readOnly);
|
rc = sqlite3OsOpenReadWrite(argv[2], &fd, &readOnly);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0);
|
Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0);
|
||||||
|
@@ -1036,6 +1036,7 @@ static int vdbeCommit(sqlite *db){
|
|||||||
|
|
||||||
/* Open the master journal. */
|
/* Open the master journal. */
|
||||||
assert( strlen(zMaster)<db->nMaster );
|
assert( strlen(zMaster)<db->nMaster );
|
||||||
|
memset(&master, 0, sizeof(master));
|
||||||
rc = sqlite3OsOpenExclusive(zMaster, &master, 0);
|
rc = sqlite3OsOpenExclusive(zMaster, &master, 0);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
sqliteFree(zMaster);
|
sqliteFree(zMaster);
|
||||||
@@ -1789,6 +1790,3 @@ void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){
|
|||||||
void sqlite3VdbeCountChanges(Vdbe *p){
|
void sqlite3VdbeCountChanges(Vdbe *p){
|
||||||
p->changeCntOn = 1;
|
p->changeCntOn = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
# focus of this script is testing the ATTACH and DETACH commands
|
# focus of this script is testing the ATTACH and DETACH commands
|
||||||
# and related functionality.
|
# and related functionality.
|
||||||
#
|
#
|
||||||
# $Id: attach2.test,v 1.20 2004/06/19 09:08:16 danielk1977 Exp $
|
# $Id: attach2.test,v 1.21 2004/06/21 18:14:47 drh Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
@@ -366,9 +366,3 @@ do_test attach2-6.4 {
|
|||||||
db close
|
db close
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user