Fossil

Check-in [e95e87c1ed]
Login

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

Overview
Comment:When compiled with FOSSIL_DEBUG, print warnings if any SQLite queries fail to use indices.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e95e87c1edf4b1ef85bcaf3d1bab7d90d882215d
User & Date: drh 2010-03-31 14:35:53.000
Context
2010-03-31
14:52
Cause all SQLite errors to be logged as warnings. check-in: 99fea6cde4 user: drh tags: trunk
14:35
When compiled with FOSSIL_DEBUG, print warnings if any SQLite queries fail to use indices. check-in: e95e87c1ed user: drh tags: trunk
2010-03-30
14:29
Use artifact IDs, not record IDs, on the "diff" link of check-in change listings. check-in: 61c52dd6aa user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
272
273
274
275
276
277
278


















279
280
281
282
283


284
285
286
287
288
289

290
291
292
293
294
295
296
** or SQLITE_OK if the statement finishes successfully.
*/
int db_step(Stmt *pStmt){
  int rc;
  rc = sqlite3_step(pStmt->pStmt);
  return rc;
}



















/*
** Reset or finalize a statement.
*/
int db_reset(Stmt *pStmt){


  int rc = sqlite3_reset(pStmt->pStmt);
  db_check_result(rc);
  return rc;
}
int db_finalize(Stmt *pStmt){
  int rc;

  blob_reset(&pStmt->sql);
  rc = sqlite3_finalize(pStmt->pStmt);
  db_check_result(rc);
  pStmt->pStmt = 0;
  if( pStmt->pNext ){
    pStmt->pNext->pPrev = pStmt->pPrev;
  }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





>
>
|





>







272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
** or SQLITE_OK if the statement finishes successfully.
*/
int db_step(Stmt *pStmt){
  int rc;
  rc = sqlite3_step(pStmt->pStmt);
  return rc;
}

/*
** Print warnings if a query is inefficient.
*/
static void db_stats(Stmt *pStmt){
#ifdef FOSSIL_DEBUG
  int c1, c2;
  c1 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, 1);
  c2 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_SORT, 1);
  /* printf("**** steps=%d & sorts=%d in [%s]\n", c1, c2,
     sqlite3_sql(pStmt->pStmt)); */
  if( c1>5 ){
    fossil_warning("%d scan steps in [%s]", c1, sqlite3_sql(pStmt->pStmt));
  }else if( c2 ){
    fossil_warning("sort w/o index in [%s]", sqlite3_sql(pStmt->pStmt));
  }
#endif
}

/*
** Reset or finalize a statement.
*/
int db_reset(Stmt *pStmt){
  int rc;
  db_stats(pStmt);
  rc = sqlite3_reset(pStmt->pStmt);
  db_check_result(rc);
  return rc;
}
int db_finalize(Stmt *pStmt){
  int rc;
  db_stats(pStmt);
  blob_reset(&pStmt->sql);
  rc = sqlite3_finalize(pStmt->pStmt);
  db_check_result(rc);
  pStmt->pStmt = 0;
  if( pStmt->pNext ){
    pStmt->pNext->pPrev = pStmt->pPrev;
  }