Fossil SCM

Ensure that the synclog table exists before trying to query it.

drh 2021-12-20 12:54 synclog
Commit 42a23ae71f3923db839c0cd12d25cb1b6439fe5cc139c8a87d7b64453ef8ebfb
1 file changed +7 -2
+7 -2
--- src/xfer.c
+++ src/xfer.c
@@ -1747,11 +1747,14 @@
17471747
/* pragma req-synclog ?CLIENT-URL?
17481748
**
17491749
** Request synclog data. If the CLIENT-URL argument is provided,
17501750
** it will be the canonical URL for the client.
17511751
*/
1752
- if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){
1752
+ if( blob_eq(&xfer.aToken[1], "req-synclog")
1753
+ && g.perm.RdSLog
1754
+ && db_table_exists("repository","synclog")
1755
+ ){
17531756
Stmt qSynclog;
17541757
if( xfer.nToken>=2 ){
17551758
zClientUrl = blob_str(&xfer.aToken[2]);
17561759
if( zClientUrl!=0
17571760
&& sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0
@@ -2221,11 +2224,13 @@
22212224
}
22222225
if( zSelfUrl==0 ){
22232226
blob_appendf(&send,"pragma req-synclog\n");
22242227
}else{
22252228
blob_appendf(&send,"pragma req-synclog %s\n", zSelfUrl);
2226
- if( syncFlags & SYNC_PUSH_SYNCLOG ){
2229
+ if( (syncFlags & SYNC_PUSH_SYNCLOG)!=0
2230
+ && db_table_exists("repository","synclog")
2231
+ ){
22272232
Stmt qSynclog;
22282233
db_prepare(&qSynclog,
22292234
"SELECT sfrom, sto, unixepoch(stime), stype FROM synclog"
22302235
" WHERE sfrom!=%Q AND sto!=%Q",
22312236
g.url.canonical, g.url.canonical
22322237
--- src/xfer.c
+++ src/xfer.c
@@ -1747,11 +1747,14 @@
1747 /* pragma req-synclog ?CLIENT-URL?
1748 **
1749 ** Request synclog data. If the CLIENT-URL argument is provided,
1750 ** it will be the canonical URL for the client.
1751 */
1752 if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){
 
 
 
1753 Stmt qSynclog;
1754 if( xfer.nToken>=2 ){
1755 zClientUrl = blob_str(&xfer.aToken[2]);
1756 if( zClientUrl!=0
1757 && sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0
@@ -2221,11 +2224,13 @@
2221 }
2222 if( zSelfUrl==0 ){
2223 blob_appendf(&send,"pragma req-synclog\n");
2224 }else{
2225 blob_appendf(&send,"pragma req-synclog %s\n", zSelfUrl);
2226 if( syncFlags & SYNC_PUSH_SYNCLOG ){
 
 
2227 Stmt qSynclog;
2228 db_prepare(&qSynclog,
2229 "SELECT sfrom, sto, unixepoch(stime), stype FROM synclog"
2230 " WHERE sfrom!=%Q AND sto!=%Q",
2231 g.url.canonical, g.url.canonical
2232
--- src/xfer.c
+++ src/xfer.c
@@ -1747,11 +1747,14 @@
1747 /* pragma req-synclog ?CLIENT-URL?
1748 **
1749 ** Request synclog data. If the CLIENT-URL argument is provided,
1750 ** it will be the canonical URL for the client.
1751 */
1752 if( blob_eq(&xfer.aToken[1], "req-synclog")
1753 && g.perm.RdSLog
1754 && db_table_exists("repository","synclog")
1755 ){
1756 Stmt qSynclog;
1757 if( xfer.nToken>=2 ){
1758 zClientUrl = blob_str(&xfer.aToken[2]);
1759 if( zClientUrl!=0
1760 && sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0
@@ -2221,11 +2224,13 @@
2224 }
2225 if( zSelfUrl==0 ){
2226 blob_appendf(&send,"pragma req-synclog\n");
2227 }else{
2228 blob_appendf(&send,"pragma req-synclog %s\n", zSelfUrl);
2229 if( (syncFlags & SYNC_PUSH_SYNCLOG)!=0
2230 && db_table_exists("repository","synclog")
2231 ){
2232 Stmt qSynclog;
2233 db_prepare(&qSynclog,
2234 "SELECT sfrom, sto, unixepoch(stime), stype FROM synclog"
2235 " WHERE sfrom!=%Q AND sto!=%Q",
2236 g.url.canonical, g.url.canonical
2237

Keyboard Shortcuts

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