Fossil SCM

Do not complain about unfinalized SQL statements when exiting on a fatal error. Fix comments and indentation on the vfile_verify_not_phantom() function.

drh 2011-01-07 17:08 trunk
Commit c2f5dbe65527d18339a570088f67022a8a29a890
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -290,8 +290,8 @@
290290
db_must_be_within_tree();
291291
if( !forceFlag && unsaved_changes()==1 ){
292292
fossil_fatal("there are unsaved changes in the current checkout");
293293
}
294294
unlink_local_database(1);
295
- db_close();
295
+ db_close(1);
296296
unlink_local_database(0);
297297
}
298298
--- src/checkout.c
+++ src/checkout.c
@@ -290,8 +290,8 @@
290 db_must_be_within_tree();
291 if( !forceFlag && unsaved_changes()==1 ){
292 fossil_fatal("there are unsaved changes in the current checkout");
293 }
294 unlink_local_database(1);
295 db_close();
296 unlink_local_database(0);
297 }
298
--- src/checkout.c
+++ src/checkout.c
@@ -290,8 +290,8 @@
290 db_must_be_within_tree();
291 if( !forceFlag && unsaved_changes()==1 ){
292 fossil_fatal("there are unsaved changes in the current checkout");
293 }
294 unlink_local_database(1);
295 db_close(1);
296 unlink_local_database(0);
297 }
298
+2 -2
--- src/clone.c
+++ src/clone.c
@@ -57,11 +57,11 @@
5757
zDefaultUser = find_option("admin-user","A",1);
5858
5959
url_parse(g.argv[2]);
6060
if( g.urlIsFile ){
6161
file_copy(g.urlName, g.argv[3]);
62
- db_close();
62
+ db_close(1);
6363
db_open_repository(g.argv[3]);
6464
db_record_repository_filename(g.argv[3]);
6565
db_multi_exec(
6666
"REPLACE INTO config(name,value)"
6767
" VALUES('server-code', lower(hex(randomblob(20))));"
@@ -98,11 +98,11 @@
9898
g.xlinkClusterOnly = 1;
9999
nErr = client_sync(0,0,1,CONFIGSET_ALL,0);
100100
g.xlinkClusterOnly = 0;
101101
verify_cancel();
102102
db_end_transaction(0);
103
- db_close();
103
+ db_close(1);
104104
if( nErr ){
105105
unlink(g.argv[3]);
106106
fossil_fatal("server returned an error - clone aborted");
107107
}
108108
db_open_repository(g.argv[3]);
109109
--- src/clone.c
+++ src/clone.c
@@ -57,11 +57,11 @@
57 zDefaultUser = find_option("admin-user","A",1);
58
59 url_parse(g.argv[2]);
60 if( g.urlIsFile ){
61 file_copy(g.urlName, g.argv[3]);
62 db_close();
63 db_open_repository(g.argv[3]);
64 db_record_repository_filename(g.argv[3]);
65 db_multi_exec(
66 "REPLACE INTO config(name,value)"
67 " VALUES('server-code', lower(hex(randomblob(20))));"
@@ -98,11 +98,11 @@
98 g.xlinkClusterOnly = 1;
99 nErr = client_sync(0,0,1,CONFIGSET_ALL,0);
100 g.xlinkClusterOnly = 0;
101 verify_cancel();
102 db_end_transaction(0);
103 db_close();
104 if( nErr ){
105 unlink(g.argv[3]);
106 fossil_fatal("server returned an error - clone aborted");
107 }
108 db_open_repository(g.argv[3]);
109
--- src/clone.c
+++ src/clone.c
@@ -57,11 +57,11 @@
57 zDefaultUser = find_option("admin-user","A",1);
58
59 url_parse(g.argv[2]);
60 if( g.urlIsFile ){
61 file_copy(g.urlName, g.argv[3]);
62 db_close(1);
63 db_open_repository(g.argv[3]);
64 db_record_repository_filename(g.argv[3]);
65 db_multi_exec(
66 "REPLACE INTO config(name,value)"
67 " VALUES('server-code', lower(hex(randomblob(20))));"
@@ -98,11 +98,11 @@
98 g.xlinkClusterOnly = 1;
99 nErr = client_sync(0,0,1,CONFIGSET_ALL,0);
100 g.xlinkClusterOnly = 0;
101 verify_cancel();
102 db_end_transaction(0);
103 db_close(1);
104 if( nErr ){
105 unlink(g.argv[3]);
106 fossil_fatal("server returned an error - clone aborted");
107 }
108 db_open_repository(g.argv[3]);
109
+21 -5
--- src/db.c
+++ src/db.c
@@ -126,28 +126,39 @@
126126
if( nBegin==0 ){
127127
int i;
128128
for(i=0; doRollback==0 && i<nCommitHook; i++){
129129
doRollback |= aHook[i].xHook();
130130
}
131
+ while( pAllStmt ){
132
+ db_finalize(pAllStmt);
133
+ }
131134
db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
132135
doRollback = 0;
133136
}
134137
}
138
+
139
+/*
140
+** Force a rollback and shutdown the database
141
+*/
135142
void db_force_rollback(void){
136143
static int busy = 0;
137144
if( busy || g.db==0 ) return;
138145
busy = 1;
139146
undo_rollback();
147
+ while( pAllStmt ){
148
+ db_finalize(pAllStmt);
149
+ }
140150
if( nBegin ){
141151
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
142152
nBegin = 0;
143153
if( isNewRepo ){
144
- db_close();
154
+ db_close(0);
145155
unlink(g.zRepositoryName);
146156
}
147157
}
148158
busy = 0;
159
+ db_close(0);
149160
}
150161
151162
/*
152163
** Install a commit hook. Hooks are installed in sequence order.
153164
** It is an error to install the same commit hook more than once.
@@ -920,11 +931,11 @@
920931
if( access(zRepo, 0) ){
921932
fossil_fatal("no such file: %s", zRepo);
922933
}
923934
db_open_or_attach(zRepo, "test_repo");
924935
db_lset("repository", blob_str(&repo));
925
- db_close();
936
+ db_close(1);
926937
}
927938
928939
929940
/*
930941
** Open the local database. If unable, exit with an error.
@@ -937,12 +948,15 @@
937948
db_verify_schema();
938949
}
939950
940951
/*
941952
** Close the database connection.
953
+**
954
+** Check for unfinalized statements and report errors if the reportErrors
955
+** argument is true. Ignore unfinalized statements when false.
942956
*/
943
-void db_close(void){
957
+void db_close(int reportErrors){
944958
sqlite3_stmt *pStmt;
945959
if( g.db==0 ) return;
946960
if( g.fSqlTrace ){
947961
int cur, hiwtr;
948962
sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
@@ -971,12 +985,14 @@
971985
while( pAllStmt ){
972986
db_finalize(pAllStmt);
973987
}
974988
db_end_transaction(1);
975989
pStmt = 0;
976
- while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
977
- fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
990
+ if( reportErrors ){
991
+ while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
992
+ fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
993
+ }
978994
}
979995
g.repositoryOpen = 0;
980996
g.localOpen = 0;
981997
g.configOpen = 0;
982998
sqlite3_wal_checkpoint(g.db, 0);
983999
--- src/db.c
+++ src/db.c
@@ -126,28 +126,39 @@
126 if( nBegin==0 ){
127 int i;
128 for(i=0; doRollback==0 && i<nCommitHook; i++){
129 doRollback |= aHook[i].xHook();
130 }
 
 
 
131 db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
132 doRollback = 0;
133 }
134 }
 
 
 
 
135 void db_force_rollback(void){
136 static int busy = 0;
137 if( busy || g.db==0 ) return;
138 busy = 1;
139 undo_rollback();
 
 
 
140 if( nBegin ){
141 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
142 nBegin = 0;
143 if( isNewRepo ){
144 db_close();
145 unlink(g.zRepositoryName);
146 }
147 }
148 busy = 0;
 
149 }
150
151 /*
152 ** Install a commit hook. Hooks are installed in sequence order.
153 ** It is an error to install the same commit hook more than once.
@@ -920,11 +931,11 @@
920 if( access(zRepo, 0) ){
921 fossil_fatal("no such file: %s", zRepo);
922 }
923 db_open_or_attach(zRepo, "test_repo");
924 db_lset("repository", blob_str(&repo));
925 db_close();
926 }
927
928
929 /*
930 ** Open the local database. If unable, exit with an error.
@@ -937,12 +948,15 @@
937 db_verify_schema();
938 }
939
940 /*
941 ** Close the database connection.
 
 
 
942 */
943 void db_close(void){
944 sqlite3_stmt *pStmt;
945 if( g.db==0 ) return;
946 if( g.fSqlTrace ){
947 int cur, hiwtr;
948 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
@@ -971,12 +985,14 @@
971 while( pAllStmt ){
972 db_finalize(pAllStmt);
973 }
974 db_end_transaction(1);
975 pStmt = 0;
976 while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
977 fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
 
 
978 }
979 g.repositoryOpen = 0;
980 g.localOpen = 0;
981 g.configOpen = 0;
982 sqlite3_wal_checkpoint(g.db, 0);
983
--- src/db.c
+++ src/db.c
@@ -126,28 +126,39 @@
126 if( nBegin==0 ){
127 int i;
128 for(i=0; doRollback==0 && i<nCommitHook; i++){
129 doRollback |= aHook[i].xHook();
130 }
131 while( pAllStmt ){
132 db_finalize(pAllStmt);
133 }
134 db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
135 doRollback = 0;
136 }
137 }
138
139 /*
140 ** Force a rollback and shutdown the database
141 */
142 void db_force_rollback(void){
143 static int busy = 0;
144 if( busy || g.db==0 ) return;
145 busy = 1;
146 undo_rollback();
147 while( pAllStmt ){
148 db_finalize(pAllStmt);
149 }
150 if( nBegin ){
151 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
152 nBegin = 0;
153 if( isNewRepo ){
154 db_close(0);
155 unlink(g.zRepositoryName);
156 }
157 }
158 busy = 0;
159 db_close(0);
160 }
161
162 /*
163 ** Install a commit hook. Hooks are installed in sequence order.
164 ** It is an error to install the same commit hook more than once.
@@ -920,11 +931,11 @@
931 if( access(zRepo, 0) ){
932 fossil_fatal("no such file: %s", zRepo);
933 }
934 db_open_or_attach(zRepo, "test_repo");
935 db_lset("repository", blob_str(&repo));
936 db_close(1);
937 }
938
939
940 /*
941 ** Open the local database. If unable, exit with an error.
@@ -937,12 +948,15 @@
948 db_verify_schema();
949 }
950
951 /*
952 ** Close the database connection.
953 **
954 ** Check for unfinalized statements and report errors if the reportErrors
955 ** argument is true. Ignore unfinalized statements when false.
956 */
957 void db_close(int reportErrors){
958 sqlite3_stmt *pStmt;
959 if( g.db==0 ) return;
960 if( g.fSqlTrace ){
961 int cur, hiwtr;
962 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
@@ -971,12 +985,14 @@
985 while( pAllStmt ){
986 db_finalize(pAllStmt);
987 }
988 db_end_transaction(1);
989 pStmt = 0;
990 if( reportErrors ){
991 while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
992 fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
993 }
994 }
995 g.repositoryOpen = 0;
996 g.localOpen = 0;
997 g.configOpen = 0;
998 sqlite3_wal_checkpoint(g.db, 0);
999
+5 -5
--- src/main.c
+++ src/main.c
@@ -294,11 +294,11 @@
294294
295295
/*
296296
** Exit. Take care to close the database first.
297297
*/
298298
void fossil_exit(int rc){
299
- db_close();
299
+ db_close(1);
300300
exit(rc);
301301
}
302302
303303
/*
304304
** Print an error message, rollback all databases, and quit. These
@@ -837,11 +837,11 @@
837837
fossil_fatal("cannot stat() repository: %s", zRepo);
838838
}
839839
setgid(sStat.st_gid);
840840
setuid(sStat.st_uid);
841841
if( g.db!=0 ){
842
- db_close();
842
+ db_close(1);
843843
db_open_repository(zRepo);
844844
}
845845
}
846846
#endif
847847
return zRepo;
@@ -1019,11 +1019,11 @@
10191019
db_open_repository(blob_str(&value));
10201020
blob_reset(&value);
10211021
continue;
10221022
}
10231023
if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
1024
- db_close();
1024
+ db_close(1);
10251025
g.zRepositoryName = mprintf("%s", blob_str(&value));
10261026
blob_reset(&value);
10271027
continue;
10281028
}
10291029
if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
@@ -1228,11 +1228,11 @@
12281228
#else
12291229
zBrowser = db_get("web-browser", "open");
12301230
#endif
12311231
zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
12321232
}
1233
- db_close();
1233
+ db_close(1);
12341234
if( cgi_http_server(iPort, mxPort, zBrowserCmd, flags) ){
12351235
fossil_fatal("unable to listen on TCP socket %d", iPort);
12361236
}
12371237
g.httpIn = stdin;
12381238
g.httpOut = stdout;
@@ -1248,9 +1248,9 @@
12481248
/* Win32 implementation */
12491249
if( isUiCmd ){
12501250
zBrowser = db_get("web-browser", "start");
12511251
zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
12521252
}
1253
- db_close();
1253
+ db_close(1);
12541254
win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags);
12551255
#endif
12561256
}
12571257
--- src/main.c
+++ src/main.c
@@ -294,11 +294,11 @@
294
295 /*
296 ** Exit. Take care to close the database first.
297 */
298 void fossil_exit(int rc){
299 db_close();
300 exit(rc);
301 }
302
303 /*
304 ** Print an error message, rollback all databases, and quit. These
@@ -837,11 +837,11 @@
837 fossil_fatal("cannot stat() repository: %s", zRepo);
838 }
839 setgid(sStat.st_gid);
840 setuid(sStat.st_uid);
841 if( g.db!=0 ){
842 db_close();
843 db_open_repository(zRepo);
844 }
845 }
846 #endif
847 return zRepo;
@@ -1019,11 +1019,11 @@
1019 db_open_repository(blob_str(&value));
1020 blob_reset(&value);
1021 continue;
1022 }
1023 if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
1024 db_close();
1025 g.zRepositoryName = mprintf("%s", blob_str(&value));
1026 blob_reset(&value);
1027 continue;
1028 }
1029 if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
@@ -1228,11 +1228,11 @@
1228 #else
1229 zBrowser = db_get("web-browser", "open");
1230 #endif
1231 zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
1232 }
1233 db_close();
1234 if( cgi_http_server(iPort, mxPort, zBrowserCmd, flags) ){
1235 fossil_fatal("unable to listen on TCP socket %d", iPort);
1236 }
1237 g.httpIn = stdin;
1238 g.httpOut = stdout;
@@ -1248,9 +1248,9 @@
1248 /* Win32 implementation */
1249 if( isUiCmd ){
1250 zBrowser = db_get("web-browser", "start");
1251 zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
1252 }
1253 db_close();
1254 win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags);
1255 #endif
1256 }
1257
--- src/main.c
+++ src/main.c
@@ -294,11 +294,11 @@
294
295 /*
296 ** Exit. Take care to close the database first.
297 */
298 void fossil_exit(int rc){
299 db_close(1);
300 exit(rc);
301 }
302
303 /*
304 ** Print an error message, rollback all databases, and quit. These
@@ -837,11 +837,11 @@
837 fossil_fatal("cannot stat() repository: %s", zRepo);
838 }
839 setgid(sStat.st_gid);
840 setuid(sStat.st_uid);
841 if( g.db!=0 ){
842 db_close(1);
843 db_open_repository(zRepo);
844 }
845 }
846 #endif
847 return zRepo;
@@ -1019,11 +1019,11 @@
1019 db_open_repository(blob_str(&value));
1020 blob_reset(&value);
1021 continue;
1022 }
1023 if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
1024 db_close(1);
1025 g.zRepositoryName = mprintf("%s", blob_str(&value));
1026 blob_reset(&value);
1027 continue;
1028 }
1029 if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
@@ -1228,11 +1228,11 @@
1228 #else
1229 zBrowser = db_get("web-browser", "open");
1230 #endif
1231 zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
1232 }
1233 db_close(1);
1234 if( cgi_http_server(iPort, mxPort, zBrowserCmd, flags) ){
1235 fossil_fatal("unable to listen on TCP socket %d", iPort);
1236 }
1237 g.httpIn = stdin;
1238 g.httpOut = stdout;
@@ -1248,9 +1248,9 @@
1248 /* Win32 implementation */
1249 if( isUiCmd ){
1250 zBrowser = db_get("web-browser", "start");
1251 zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
1252 }
1253 db_close(1);
1254 win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags);
1255 #endif
1256 }
1257
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -364,11 +364,11 @@
364364
}else{
365365
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
366366
if( g.argc!=2 ){
367367
usage("?REPOSITORY-FILENAME?");
368368
}
369
- db_close();
369
+ db_close(1);
370370
db_open_repository(g.zRepositoryName);
371371
}
372372
db_begin_transaction();
373373
ttyOutput = 1;
374374
errCnt = rebuild_db(randomizeFlag, 1);
@@ -420,11 +420,11 @@
420420
}else{
421421
db_find_and_open_repository(0, 0);
422422
if( g.argc!=2 ){
423423
usage("?REPOSITORY-FILENAME?");
424424
}
425
- db_close();
425
+ db_close(1);
426426
db_open_repository(g.zRepositoryName);
427427
}
428428
db_begin_transaction();
429429
create_cluster();
430430
db_end_transaction(0);
431431
--- src/rebuild.c
+++ src/rebuild.c
@@ -364,11 +364,11 @@
364 }else{
365 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
366 if( g.argc!=2 ){
367 usage("?REPOSITORY-FILENAME?");
368 }
369 db_close();
370 db_open_repository(g.zRepositoryName);
371 }
372 db_begin_transaction();
373 ttyOutput = 1;
374 errCnt = rebuild_db(randomizeFlag, 1);
@@ -420,11 +420,11 @@
420 }else{
421 db_find_and_open_repository(0, 0);
422 if( g.argc!=2 ){
423 usage("?REPOSITORY-FILENAME?");
424 }
425 db_close();
426 db_open_repository(g.zRepositoryName);
427 }
428 db_begin_transaction();
429 create_cluster();
430 db_end_transaction(0);
431
--- src/rebuild.c
+++ src/rebuild.c
@@ -364,11 +364,11 @@
364 }else{
365 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
366 if( g.argc!=2 ){
367 usage("?REPOSITORY-FILENAME?");
368 }
369 db_close(1);
370 db_open_repository(g.zRepositoryName);
371 }
372 db_begin_transaction();
373 ttyOutput = 1;
374 errCnt = rebuild_db(randomizeFlag, 1);
@@ -420,11 +420,11 @@
420 }else{
421 db_find_and_open_repository(0, 0);
422 if( g.argc!=2 ){
423 usage("?REPOSITORY-FILENAME?");
424 }
425 db_close(1);
426 db_open_repository(g.zRepositoryName);
427 }
428 db_begin_transaction();
429 create_cluster();
430 db_end_transaction(0);
431
+1 -1
--- src/shun.c
+++ src/shun.c
@@ -48,11 +48,11 @@
4848
login_check_credentials();
4949
if( !g.okAdmin ){
5050
login_needed();
5151
}
5252
if( P("rebuild") ){
53
- db_close();
53
+ db_close(1);
5454
db_open_repository(g.zRepositoryName);
5555
db_begin_transaction();
5656
rebuild_db(0,0);
5757
db_end_transaction(0);
5858
}
5959
--- src/shun.c
+++ src/shun.c
@@ -48,11 +48,11 @@
48 login_check_credentials();
49 if( !g.okAdmin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close();
54 db_open_repository(g.zRepositoryName);
55 db_begin_transaction();
56 rebuild_db(0,0);
57 db_end_transaction(0);
58 }
59
--- src/shun.c
+++ src/shun.c
@@ -48,11 +48,11 @@
48 login_check_credentials();
49 if( !g.okAdmin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
55 db_begin_transaction();
56 rebuild_db(0,0);
57 db_end_transaction(0);
58 }
59
+1 -1
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -79,11 +79,11 @@
7979
** running any SQL commands that modifies the repository database.
8080
*/
8181
void sqlite3_cmd(void){
8282
extern int sqlite3_shell(int, char**);
8383
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
84
- db_close();
84
+ db_close(1);
8585
sqlite3_shutdown();
8686
sqlite3_shell(g.argc-1, g.argv+1);
8787
}
8888
8989
/*
9090
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -79,11 +79,11 @@
79 ** running any SQL commands that modifies the repository database.
80 */
81 void sqlite3_cmd(void){
82 extern int sqlite3_shell(int, char**);
83 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
84 db_close();
85 sqlite3_shutdown();
86 sqlite3_shell(g.argc-1, g.argv+1);
87 }
88
89 /*
90
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -79,11 +79,11 @@
79 ** running any SQL commands that modifies the repository database.
80 */
81 void sqlite3_cmd(void){
82 extern int sqlite3_shell(int, char**);
83 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
84 db_close(1);
85 sqlite3_shutdown();
86 sqlite3_shell(g.argc-1, g.argv+1);
87 }
88
89 /*
90
+3 -2
--- src/vfile.c
+++ src/vfile.c
@@ -72,19 +72,20 @@
7272
return rid;
7373
}
7474
7575
/*
7676
** Verify that an object is not a phantom. If the object is
77
-** a phantom, output an error message and quick.
77
+** a phantom, output an error message and quit.
7878
*/
7979
static void vfile_verify_not_phantom(
8080
int rid, /* The RID to verify */
8181
const char *zFilename, /* Filename. Might be NULL */
8282
const char *zUuid /* UUID. Might be NULL */
8383
){
8484
if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
85
- && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid)) ){
85
+ && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'",zUuid))
86
+ ){
8687
if( zFilename ){
8788
fossil_fatal("content missing for %s", zFilename);
8889
}else{
8990
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
9091
if( zUuid ){
9192
--- src/vfile.c
+++ src/vfile.c
@@ -72,19 +72,20 @@
72 return rid;
73 }
74
75 /*
76 ** Verify that an object is not a phantom. If the object is
77 ** a phantom, output an error message and quick.
78 */
79 static void vfile_verify_not_phantom(
80 int rid, /* The RID to verify */
81 const char *zFilename, /* Filename. Might be NULL */
82 const char *zUuid /* UUID. Might be NULL */
83 ){
84 if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
85 && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid)) ){
 
86 if( zFilename ){
87 fossil_fatal("content missing for %s", zFilename);
88 }else{
89 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
90 if( zUuid ){
91
--- src/vfile.c
+++ src/vfile.c
@@ -72,19 +72,20 @@
72 return rid;
73 }
74
75 /*
76 ** Verify that an object is not a phantom. If the object is
77 ** a phantom, output an error message and quit.
78 */
79 static void vfile_verify_not_phantom(
80 int rid, /* The RID to verify */
81 const char *zFilename, /* Filename. Might be NULL */
82 const char *zUuid /* UUID. Might be NULL */
83 ){
84 if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
85 && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'",zUuid))
86 ){
87 if( zFilename ){
88 fossil_fatal("content missing for %s", zFilename);
89 }else{
90 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
91 if( zUuid ){
92

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button