Fossil

Check-in [8d9ad750]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the /test-warning webpage.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8d9ad7501e1fc4acafbccc260512f1832cae88c61fc2db759778468c62f4f4f3
User & Date: drh 2018-06-24 17:51:39.264
Context
2018-06-24
18:22
Only invoke the email alert sender after a successful HTTP request. Mark Not Found requests as 404, unsuccessful. ... (check-in: 4eb3e0f2 user: drh tags: trunk)
17:51
Improvements to the /test-warning webpage. ... (check-in: 8d9ad750 user: drh tags: trunk)
17:44
Extra defenses against running the digest alert generator in a context where the transaction will rollback, thus failing to record the new digest time. Change the "fossil server" and "fossil ui" commands to always log errors to the console if no other error logging is defined. ... (check-in: f87fb027 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    db.doRollback = 0;
  }
  db.nBegin++;
}
void db_end_transaction(int rollbackFlag){
  if( g.db==0 ) return;
  if( db.nBegin<=0 ){
    fossil_warning("Extra call to db_end_transaction\n");
    return;
  }
  if( rollbackFlag ){
    db.doRollback = 1;
    if( g.fSqlTrace ) fossil_trace("-- ROLLBACK by request\n");
  }
  db.nBegin--;







|







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    db.doRollback = 0;
  }
  db.nBegin++;
}
void db_end_transaction(int rollbackFlag){
  if( g.db==0 ) return;
  if( db.nBegin<=0 ){
    fossil_warning("Extra call to db_end_transaction");
    return;
  }
  if( rollbackFlag ){
    db.doRollback = 1;
    if( g.fSqlTrace ) fossil_trace("-- ROLLBACK by request\n");
  }
  db.nBegin--;
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
    fprintf(stderr, "-- PCACHE_OVFLOW          %10d %10d\n", cur, hiwtr);
    fprintf(stderr, "-- prepared statements    %10d\n", db.nPrepare);
  }
  while( db.pAllStmt ){
    db_finalize(db.pAllStmt);
  }
  if( db.nBegin ){
    fossil_warning("Missed call to db_end_transaction(). Rolling back.\n");
    db_end_transaction(1);
  }
  pStmt = 0;
  g.dbIgnoreErrors++; /* Stop "database locked" warnings from PRAGMA optimize */
  sqlite3_exec(g.db, "PRAGMA optimize", 0, 0, 0);
  g.dbIgnoreErrors--;
  db_close_config();







|







1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
    fprintf(stderr, "-- PCACHE_OVFLOW          %10d %10d\n", cur, hiwtr);
    fprintf(stderr, "-- prepared statements    %10d\n", db.nPrepare);
  }
  while( db.pAllStmt ){
    db_finalize(db.pAllStmt);
  }
  if( db.nBegin ){
    fossil_warning("Missed call to db_end_transaction(). Rolling back.");
    db_end_transaction(1);
  }
  pStmt = 0;
  g.dbIgnoreErrors++; /* Stop "database locked" warnings from PRAGMA optimize */
  sqlite3_exec(g.db, "PRAGMA optimize", 0, 0, 0);
  g.dbIgnoreErrors--;
  db_close_config();
Changes to src/main.c.
2722
2723
2724
2725
2726
2727
2728

2729
2730
2731
2732



2733

2734
2735
2736
2737
2738
2739
2740
**
**     case=1           Issue a fossil_warning() while generating the page.
**     case=2           Extra db_begin_transaction()
**     case=3           Extra db_end_transaction()
*/
void test_warning_page(void){
  int iCase = atoi(PD("case","1"));

  login_check_credentials();
  if( !g.perm.Admin ){ fossil_redirect_home(); return; }
  style_header("Warning Test Page");
  @ <p>This is the test page for case=%d(iCase)</p>



  @ <ol>

  @ <li value='1'> Call fossil_warning()
  if( iCase==1 ){
    fossil_warning("Test warning message from /test-warning");
  }
  @ <li value='2'> Call db_begin_transaction()
  if( iCase==2 ){
    db_begin_transaction();







>



|
>
>
>
|
>







2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
**
**     case=1           Issue a fossil_warning() while generating the page.
**     case=2           Extra db_begin_transaction()
**     case=3           Extra db_end_transaction()
*/
void test_warning_page(void){
  int iCase = atoi(PD("case","1"));
  int i;
  login_check_credentials();
  if( !g.perm.Admin ){ fossil_redirect_home(); return; }
  style_header("Warning Test Page");
  @ <p>This is the test page for case=%d(iCase).  Cases:
  for(i=1; i<=3; i++){
    @ <a href='./test-warning?case=%d(i)'>[%d(i)]</a>
  }
  @ </p>
  @ <p><ol>
  @ <li value='1'> Call fossil_warning()
  if( iCase==1 ){
    fossil_warning("Test warning message from /test-warning");
  }
  @ <li value='2'> Call db_begin_transaction()
  if( iCase==2 ){
    db_begin_transaction();