Fossil SCM

Use the new octet_length() SQL function in place of length() where it is appropriate to do so.

drh 2023-06-23 12:29 trunk
Commit 604e1a67d38a5e6e3c3d42f49c3fbd1fab84259fa6ac1e70e2f6a803a837d13b
+2 -2
--- src/bundle.c
+++ src/bundle.c
@@ -114,11 +114,11 @@
114114
db_finalize(&q);
115115
fossil_print("%.78c\n",'-');
116116
if( bDetails ){
117117
db_prepare(&q,
118118
"SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),''),"
119
- " sz, length(data), notes"
119
+ " sz, octet_length(data), notes"
120120
" FROM bblob"
121121
);
122122
while( db_step(&q)==SQLITE_ROW ){
123123
fossil_print("%4d %10s %10s %8d %8d %s\n",
124124
db_column_int(&q,0),
@@ -591,11 +591,11 @@
591591
** repo, then the delta encodings cannot be decoded and the bundle cannot
592592
** be extracted. */
593593
zMissingDeltas = db_text(0,
594594
"SELECT group_concat(substr(delta,1,10),' ')"
595595
" FROM bblob"
596
- " WHERE typeof(delta)='text' AND length(delta)>=%d"
596
+ " WHERE typeof(delta)='text' AND octet_length(delta)>=%d"
597597
" AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)",
598598
HNAME_MIN);
599599
if( zMissingDeltas && zMissingDeltas[0] ){
600600
fossil_fatal("delta basis artifacts not found in repository: %s",
601601
zMissingDeltas);
602602
--- src/bundle.c
+++ src/bundle.c
@@ -114,11 +114,11 @@
114 db_finalize(&q);
115 fossil_print("%.78c\n",'-');
116 if( bDetails ){
117 db_prepare(&q,
118 "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),''),"
119 " sz, length(data), notes"
120 " FROM bblob"
121 );
122 while( db_step(&q)==SQLITE_ROW ){
123 fossil_print("%4d %10s %10s %8d %8d %s\n",
124 db_column_int(&q,0),
@@ -591,11 +591,11 @@
591 ** repo, then the delta encodings cannot be decoded and the bundle cannot
592 ** be extracted. */
593 zMissingDeltas = db_text(0,
594 "SELECT group_concat(substr(delta,1,10),' ')"
595 " FROM bblob"
596 " WHERE typeof(delta)='text' AND length(delta)>=%d"
597 " AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)",
598 HNAME_MIN);
599 if( zMissingDeltas && zMissingDeltas[0] ){
600 fossil_fatal("delta basis artifacts not found in repository: %s",
601 zMissingDeltas);
602
--- src/bundle.c
+++ src/bundle.c
@@ -114,11 +114,11 @@
114 db_finalize(&q);
115 fossil_print("%.78c\n",'-');
116 if( bDetails ){
117 db_prepare(&q,
118 "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),''),"
119 " sz, octet_length(data), notes"
120 " FROM bblob"
121 );
122 while( db_step(&q)==SQLITE_ROW ){
123 fossil_print("%4d %10s %10s %8d %8d %s\n",
124 db_column_int(&q,0),
@@ -591,11 +591,11 @@
591 ** repo, then the delta encodings cannot be decoded and the bundle cannot
592 ** be extracted. */
593 zMissingDeltas = db_text(0,
594 "SELECT group_concat(substr(delta,1,10),' ')"
595 " FROM bblob"
596 " WHERE typeof(delta)='text' AND octet_length(delta)>=%d"
597 " AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)",
598 HNAME_MIN);
599 if( zMissingDeltas && zMissingDeltas[0] ){
600 fossil_fatal("delta basis artifacts not found in repository: %s",
601 zMissingDeltas);
602
+2 -2
--- src/chat.c
+++ src/chat.c
@@ -588,11 +588,11 @@
588588
zChatUser = db_get("chat-timeline-user",0);
589589
chat_create_tables();
590590
cgi_set_content_type("application/json");
591591
dataVersion = db_int64(0, "PRAGMA data_version");
592592
blob_append_sql(&sql,
593
- "SELECT msgid, datetime(mtime), xfrom, xmsg, length(file),"
593
+ "SELECT msgid, datetime(mtime), xfrom, xmsg, octet_length(file),"
594594
" fname, fmime, %s, lmtime"
595595
" FROM chat ",
596596
msgBefore>0 ? "0 as mdel" : "mdel");
597597
if( msgid<=0 || msgBefore>0 ){
598598
db_begin_write();
@@ -727,11 +727,11 @@
727727
}
728728
zChatUser = db_get("chat-timeline-user",0);
729729
chat_create_tables();
730730
cgi_set_content_type("application/json");
731731
db_prepare(&q,
732
- "SELECT datetime(mtime), xfrom, xmsg, length(file),"
732
+ "SELECT datetime(mtime), xfrom, xmsg, octet_length(file),"
733733
" fname, fmime, lmtime"
734734
" FROM chat WHERE msgid=%d AND mdel IS NULL",
735735
msgid);
736736
if(SQLITE_ROW==db_step(&q)){
737737
const char *zDate = db_column_text(&q, 0);
738738
--- src/chat.c
+++ src/chat.c
@@ -588,11 +588,11 @@
588 zChatUser = db_get("chat-timeline-user",0);
589 chat_create_tables();
590 cgi_set_content_type("application/json");
591 dataVersion = db_int64(0, "PRAGMA data_version");
592 blob_append_sql(&sql,
593 "SELECT msgid, datetime(mtime), xfrom, xmsg, length(file),"
594 " fname, fmime, %s, lmtime"
595 " FROM chat ",
596 msgBefore>0 ? "0 as mdel" : "mdel");
597 if( msgid<=0 || msgBefore>0 ){
598 db_begin_write();
@@ -727,11 +727,11 @@
727 }
728 zChatUser = db_get("chat-timeline-user",0);
729 chat_create_tables();
730 cgi_set_content_type("application/json");
731 db_prepare(&q,
732 "SELECT datetime(mtime), xfrom, xmsg, length(file),"
733 " fname, fmime, lmtime"
734 " FROM chat WHERE msgid=%d AND mdel IS NULL",
735 msgid);
736 if(SQLITE_ROW==db_step(&q)){
737 const char *zDate = db_column_text(&q, 0);
738
--- src/chat.c
+++ src/chat.c
@@ -588,11 +588,11 @@
588 zChatUser = db_get("chat-timeline-user",0);
589 chat_create_tables();
590 cgi_set_content_type("application/json");
591 dataVersion = db_int64(0, "PRAGMA data_version");
592 blob_append_sql(&sql,
593 "SELECT msgid, datetime(mtime), xfrom, xmsg, octet_length(file),"
594 " fname, fmime, %s, lmtime"
595 " FROM chat ",
596 msgBefore>0 ? "0 as mdel" : "mdel");
597 if( msgid<=0 || msgBefore>0 ){
598 db_begin_write();
@@ -727,11 +727,11 @@
727 }
728 zChatUser = db_get("chat-timeline-user",0);
729 chat_create_tables();
730 cgi_set_content_type("application/json");
731 db_prepare(&q,
732 "SELECT datetime(mtime), xfrom, xmsg, octet_length(file),"
733 " fname, fmime, lmtime"
734 " FROM chat WHERE msgid=%d AND mdel IS NULL",
735 msgid);
736 if(SQLITE_ROW==db_step(&q)){
737 const char *zDate = db_column_text(&q, 0);
738
+1 -1
--- src/content.c
+++ src/content.c
@@ -904,11 +904,11 @@
904904
blob_compress(&bestDelta, &bestDelta);
905905
db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid);
906906
db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc);
907907
db_bind_blob(&s1, ":data", &bestDelta);
908908
db_begin_transaction();
909
- rc = db_int(0, "SELECT length(content) FROM blob WHERE rid=%d", rid);
909
+ rc = db_int(0, "SELECT octet_length(content) FROM blob WHERE rid=%d", rid);
910910
db_exec(&s1);
911911
db_exec(&s2);
912912
db_end_transaction(0);
913913
db_finalize(&s1);
914914
db_finalize(&s2);
915915
--- src/content.c
+++ src/content.c
@@ -904,11 +904,11 @@
904 blob_compress(&bestDelta, &bestDelta);
905 db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid);
906 db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc);
907 db_bind_blob(&s1, ":data", &bestDelta);
908 db_begin_transaction();
909 rc = db_int(0, "SELECT length(content) FROM blob WHERE rid=%d", rid);
910 db_exec(&s1);
911 db_exec(&s2);
912 db_end_transaction(0);
913 db_finalize(&s1);
914 db_finalize(&s2);
915
--- src/content.c
+++ src/content.c
@@ -904,11 +904,11 @@
904 blob_compress(&bestDelta, &bestDelta);
905 db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid);
906 db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc);
907 db_bind_blob(&s1, ":data", &bestDelta);
908 db_begin_transaction();
909 rc = db_int(0, "SELECT octet_length(content) FROM blob WHERE rid=%d", rid);
910 db_exec(&s1);
911 db_exec(&s2);
912 db_end_transaction(0);
913 db_finalize(&s1);
914 db_finalize(&s2);
915
+10 -9
--- src/login.c
+++ src/login.c
@@ -144,11 +144,11 @@
144144
else if( zCS==0 ) return 0;
145145
else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0;
146146
zPw = captcha_decode((unsigned int)atoi(zCS));
147147
if( fossil_stricmp(zPw, zPassword)!=0 ) return 0;
148148
uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'"
149
- " AND length(pw)>0 AND length(cap)>0");
149
+ " AND octet_length(pw)>0 AND octet_length(cap)>0");
150150
return uid;
151151
}
152152
153153
/*
154154
** Make sure the accesslog table exists. Create it if it does not
@@ -210,11 +210,11 @@
210210
int login_search_uid(const char **pzUsername, const char *zPasswd){
211211
char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0);
212212
int uid = db_int(0,
213213
"SELECT uid FROM user"
214214
" WHERE login=%Q"
215
- " AND length(cap)>0 AND length(pw)>0"
215
+ " AND octet_length(cap)>0 AND octet_length(pw)>0"
216216
" AND login NOT IN ('anonymous','nobody','developer','reader')"
217217
" AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
218218
" AND (info NOT LIKE '%%expires 20%%'"
219219
" OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
220220
*pzUsername, zSha1Pw, zPasswd
@@ -1134,12 +1134,12 @@
11341134
constant_time_cmp_function, 0, 0);
11351135
sqlite3_busy_timeout(pOther, 5000);
11361136
zSQL = mprintf(
11371137
"SELECT cexpire FROM user"
11381138
" WHERE login=%Q"
1139
- " AND length(cap)>0"
1140
- " AND length(pw)>0"
1139
+ " AND octet_length(cap)>0"
1140
+ " AND octet_length(pw)>0"
11411141
" AND cexpire>julianday('now')"
11421142
" AND constant_time_cmp(cookie,%Q)=0",
11431143
zLogin, zHash
11441144
);
11451145
pStmt = 0;
@@ -1188,12 +1188,12 @@
11881188
if( login_is_special(zLogin) ) return 0;
11891189
uid = db_int(0,
11901190
"SELECT uid FROM user"
11911191
" WHERE login=%Q"
11921192
" AND cexpire>julianday('now')"
1193
- " AND length(cap)>0"
1194
- " AND length(pw)>0"
1193
+ " AND octet_length(cap)>0"
1194
+ " AND octet_length(pw)>0"
11951195
" AND constant_time_cmp(cookie,%Q)=0",
11961196
zLogin, zCookie
11971197
);
11981198
return uid;
11991199
}
@@ -1335,12 +1335,12 @@
13351335
blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret",""));
13361336
sha1sum_blob(&b, &b);
13371337
if( fossil_strcmp(zHash, blob_str(&b))==0 ){
13381338
uid = db_int(0,
13391339
"SELECT uid FROM user WHERE login='anonymous'"
1340
- " AND length(cap)>0"
1341
- " AND length(pw)>0"
1340
+ " AND octet_length(cap)>0"
1341
+ " AND octet_length(pw)>0"
13421342
" AND %.17g+0.25>julianday('now')",
13431343
rTime
13441344
);
13451345
}
13461346
blob_reset(&b);
@@ -1363,11 +1363,12 @@
13631363
*/
13641364
if( uid==0 ){
13651365
const char *zRemoteUser = P("REMOTE_USER");
13661366
if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
13671367
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
1368
- " AND length(cap)>0 AND length(pw)>0", zRemoteUser);
1368
+ " AND octet_length(cap)>0 AND octet_length(pw)>0",
1369
+ zRemoteUser);
13691370
}
13701371
}
13711372
13721373
/* If the request didn't provide a login cookie or the login cookie didn't
13731374
** match a known valid user, check the HTTP "Authorization" header and
13741375
--- src/login.c
+++ src/login.c
@@ -144,11 +144,11 @@
144 else if( zCS==0 ) return 0;
145 else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0;
146 zPw = captcha_decode((unsigned int)atoi(zCS));
147 if( fossil_stricmp(zPw, zPassword)!=0 ) return 0;
148 uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'"
149 " AND length(pw)>0 AND length(cap)>0");
150 return uid;
151 }
152
153 /*
154 ** Make sure the accesslog table exists. Create it if it does not
@@ -210,11 +210,11 @@
210 int login_search_uid(const char **pzUsername, const char *zPasswd){
211 char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0);
212 int uid = db_int(0,
213 "SELECT uid FROM user"
214 " WHERE login=%Q"
215 " AND length(cap)>0 AND length(pw)>0"
216 " AND login NOT IN ('anonymous','nobody','developer','reader')"
217 " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
218 " AND (info NOT LIKE '%%expires 20%%'"
219 " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
220 *pzUsername, zSha1Pw, zPasswd
@@ -1134,12 +1134,12 @@
1134 constant_time_cmp_function, 0, 0);
1135 sqlite3_busy_timeout(pOther, 5000);
1136 zSQL = mprintf(
1137 "SELECT cexpire FROM user"
1138 " WHERE login=%Q"
1139 " AND length(cap)>0"
1140 " AND length(pw)>0"
1141 " AND cexpire>julianday('now')"
1142 " AND constant_time_cmp(cookie,%Q)=0",
1143 zLogin, zHash
1144 );
1145 pStmt = 0;
@@ -1188,12 +1188,12 @@
1188 if( login_is_special(zLogin) ) return 0;
1189 uid = db_int(0,
1190 "SELECT uid FROM user"
1191 " WHERE login=%Q"
1192 " AND cexpire>julianday('now')"
1193 " AND length(cap)>0"
1194 " AND length(pw)>0"
1195 " AND constant_time_cmp(cookie,%Q)=0",
1196 zLogin, zCookie
1197 );
1198 return uid;
1199 }
@@ -1335,12 +1335,12 @@
1335 blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret",""));
1336 sha1sum_blob(&b, &b);
1337 if( fossil_strcmp(zHash, blob_str(&b))==0 ){
1338 uid = db_int(0,
1339 "SELECT uid FROM user WHERE login='anonymous'"
1340 " AND length(cap)>0"
1341 " AND length(pw)>0"
1342 " AND %.17g+0.25>julianday('now')",
1343 rTime
1344 );
1345 }
1346 blob_reset(&b);
@@ -1363,11 +1363,12 @@
1363 */
1364 if( uid==0 ){
1365 const char *zRemoteUser = P("REMOTE_USER");
1366 if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
1367 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
1368 " AND length(cap)>0 AND length(pw)>0", zRemoteUser);
 
1369 }
1370 }
1371
1372 /* If the request didn't provide a login cookie or the login cookie didn't
1373 ** match a known valid user, check the HTTP "Authorization" header and
1374
--- src/login.c
+++ src/login.c
@@ -144,11 +144,11 @@
144 else if( zCS==0 ) return 0;
145 else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0;
146 zPw = captcha_decode((unsigned int)atoi(zCS));
147 if( fossil_stricmp(zPw, zPassword)!=0 ) return 0;
148 uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'"
149 " AND octet_length(pw)>0 AND octet_length(cap)>0");
150 return uid;
151 }
152
153 /*
154 ** Make sure the accesslog table exists. Create it if it does not
@@ -210,11 +210,11 @@
210 int login_search_uid(const char **pzUsername, const char *zPasswd){
211 char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0);
212 int uid = db_int(0,
213 "SELECT uid FROM user"
214 " WHERE login=%Q"
215 " AND octet_length(cap)>0 AND octet_length(pw)>0"
216 " AND login NOT IN ('anonymous','nobody','developer','reader')"
217 " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
218 " AND (info NOT LIKE '%%expires 20%%'"
219 " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
220 *pzUsername, zSha1Pw, zPasswd
@@ -1134,12 +1134,12 @@
1134 constant_time_cmp_function, 0, 0);
1135 sqlite3_busy_timeout(pOther, 5000);
1136 zSQL = mprintf(
1137 "SELECT cexpire FROM user"
1138 " WHERE login=%Q"
1139 " AND octet_length(cap)>0"
1140 " AND octet_length(pw)>0"
1141 " AND cexpire>julianday('now')"
1142 " AND constant_time_cmp(cookie,%Q)=0",
1143 zLogin, zHash
1144 );
1145 pStmt = 0;
@@ -1188,12 +1188,12 @@
1188 if( login_is_special(zLogin) ) return 0;
1189 uid = db_int(0,
1190 "SELECT uid FROM user"
1191 " WHERE login=%Q"
1192 " AND cexpire>julianday('now')"
1193 " AND octet_length(cap)>0"
1194 " AND octet_length(pw)>0"
1195 " AND constant_time_cmp(cookie,%Q)=0",
1196 zLogin, zCookie
1197 );
1198 return uid;
1199 }
@@ -1335,12 +1335,12 @@
1335 blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret",""));
1336 sha1sum_blob(&b, &b);
1337 if( fossil_strcmp(zHash, blob_str(&b))==0 ){
1338 uid = db_int(0,
1339 "SELECT uid FROM user WHERE login='anonymous'"
1340 " AND octet_length(cap)>0"
1341 " AND octet_length(pw)>0"
1342 " AND %.17g+0.25>julianday('now')",
1343 rTime
1344 );
1345 }
1346 blob_reset(&b);
@@ -1363,11 +1363,12 @@
1363 */
1364 if( uid==0 ){
1365 const char *zRemoteUser = P("REMOTE_USER");
1366 if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
1367 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
1368 " AND octet_length(cap)>0 AND octet_length(pw)>0",
1369 zRemoteUser);
1370 }
1371 }
1372
1373 /* If the request didn't provide a login cookie or the login cookie didn't
1374 ** match a known valid user, check the HTTP "Authorization" header and
1375
+5 -5
--- src/stat.c
+++ src/stat.c
@@ -119,11 +119,11 @@
119119
@ <tr><th>Subscribers:</th><td>
120120
}
121121
nSub = db_int(0, "SELECT count(*) FROM subscriber");
122122
iCutoff = db_get_int("email-renew-cutoff",0);
123123
nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
124
- " AND NOT sdonotcall AND length(ssub)>1"
124
+ " AND NOT sdonotcall AND octet_length(ssub)>1"
125125
" AND lastContact>=%d;", iCutoff);
126126
@ %,d(nASub) active, %,d(nSub) total
127127
@ </td></tr>
128128
rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0"
129129
" FROM config WHERE name='email-last-digest'");
@@ -209,11 +209,11 @@
209209
}
210210
if( db_table_exists("repository","unversioned") ){
211211
Stmt q;
212212
char zStored[100];
213213
db_prepare(&q,
214
- "SELECT count(*), sum(sz), sum(length(content))"
214
+ "SELECT count(*), sum(sz), sum(octet_length(content))"
215215
" FROM unversioned"
216216
" WHERE length(hash)>1"
217217
);
218218
if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){
219219
sqlite3_int64 iStored, pct;
@@ -243,12 +243,12 @@
243243
if( g.perm.Chat && db_table_exists("repository","chat") ){
244244
sqlite3_int64 sz = 0;
245245
char zSz[100];
246246
n = db_int(0, "SELECT max(msgid) FROM chat");
247247
m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE");
248
- sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+"
249
- "coalesce(length(file),0)) FROM chat");
248
+ sz = db_int64(0, "SELECT sum(coalesce(octet_length(xmsg),0)+"
249
+ "coalesce(octet_length(file),0)) FROM chat");
250250
approxSizeName(sizeof(zSz), zSz, sz);
251251
@ <tr><th>Number&nbsp;Of&nbsp;Chat&nbsp;Messages:</th>
252252
@ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr>
253253
}
254254
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
@@ -885,11 +885,11 @@
885885
@ szCmpr -- size as stored on disk
886886
@ );
887887
@ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr)
888888
@ SELECT blob.rid, NULL,
889889
@ delta.rid IS NOT NULL,
890
- @ size, length(content)
890
+ @ size, octet_length(content)
891891
@ FROM blob LEFT JOIN delta ON blob.rid=delta.rid
892892
@ WHERE content IS NOT NULL;
893893
;
894894
static const char zSql2[] =
895895
@ UPDATE artstat SET atype='file'
896896
--- src/stat.c
+++ src/stat.c
@@ -119,11 +119,11 @@
119 @ <tr><th>Subscribers:</th><td>
120 }
121 nSub = db_int(0, "SELECT count(*) FROM subscriber");
122 iCutoff = db_get_int("email-renew-cutoff",0);
123 nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
124 " AND NOT sdonotcall AND length(ssub)>1"
125 " AND lastContact>=%d;", iCutoff);
126 @ %,d(nASub) active, %,d(nSub) total
127 @ </td></tr>
128 rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0"
129 " FROM config WHERE name='email-last-digest'");
@@ -209,11 +209,11 @@
209 }
210 if( db_table_exists("repository","unversioned") ){
211 Stmt q;
212 char zStored[100];
213 db_prepare(&q,
214 "SELECT count(*), sum(sz), sum(length(content))"
215 " FROM unversioned"
216 " WHERE length(hash)>1"
217 );
218 if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){
219 sqlite3_int64 iStored, pct;
@@ -243,12 +243,12 @@
243 if( g.perm.Chat && db_table_exists("repository","chat") ){
244 sqlite3_int64 sz = 0;
245 char zSz[100];
246 n = db_int(0, "SELECT max(msgid) FROM chat");
247 m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE");
248 sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+"
249 "coalesce(length(file),0)) FROM chat");
250 approxSizeName(sizeof(zSz), zSz, sz);
251 @ <tr><th>Number&nbsp;Of&nbsp;Chat&nbsp;Messages:</th>
252 @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr>
253 }
254 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
@@ -885,11 +885,11 @@
885 @ szCmpr -- size as stored on disk
886 @ );
887 @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr)
888 @ SELECT blob.rid, NULL,
889 @ delta.rid IS NOT NULL,
890 @ size, length(content)
891 @ FROM blob LEFT JOIN delta ON blob.rid=delta.rid
892 @ WHERE content IS NOT NULL;
893 ;
894 static const char zSql2[] =
895 @ UPDATE artstat SET atype='file'
896
--- src/stat.c
+++ src/stat.c
@@ -119,11 +119,11 @@
119 @ <tr><th>Subscribers:</th><td>
120 }
121 nSub = db_int(0, "SELECT count(*) FROM subscriber");
122 iCutoff = db_get_int("email-renew-cutoff",0);
123 nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
124 " AND NOT sdonotcall AND octet_length(ssub)>1"
125 " AND lastContact>=%d;", iCutoff);
126 @ %,d(nASub) active, %,d(nSub) total
127 @ </td></tr>
128 rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0"
129 " FROM config WHERE name='email-last-digest'");
@@ -209,11 +209,11 @@
209 }
210 if( db_table_exists("repository","unversioned") ){
211 Stmt q;
212 char zStored[100];
213 db_prepare(&q,
214 "SELECT count(*), sum(sz), sum(octet_length(content))"
215 " FROM unversioned"
216 " WHERE length(hash)>1"
217 );
218 if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){
219 sqlite3_int64 iStored, pct;
@@ -243,12 +243,12 @@
243 if( g.perm.Chat && db_table_exists("repository","chat") ){
244 sqlite3_int64 sz = 0;
245 char zSz[100];
246 n = db_int(0, "SELECT max(msgid) FROM chat");
247 m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE");
248 sz = db_int64(0, "SELECT sum(coalesce(octet_length(xmsg),0)+"
249 "coalesce(octet_length(file),0)) FROM chat");
250 approxSizeName(sizeof(zSz), zSz, sz);
251 @ <tr><th>Number&nbsp;Of&nbsp;Chat&nbsp;Messages:</th>
252 @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr>
253 }
254 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
@@ -885,11 +885,11 @@
885 @ szCmpr -- size as stored on disk
886 @ );
887 @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr)
888 @ SELECT blob.rid, NULL,
889 @ delta.rid IS NOT NULL,
890 @ size, octet_length(content)
891 @ FROM blob LEFT JOIN delta ON blob.rid=delta.rid
892 @ WHERE content IS NOT NULL;
893 ;
894 static const char zSql2[] =
895 @ UPDATE artstat SET atype='file'
896

Keyboard Shortcuts

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