Diff
Not logged in

Differences From:

File src/content.c part of check-in [61ddd63b72] - Work toward making fossil work better on large repositories. This version implements a cache in the content manager. It is not clear yet if this is necessarily a good idea - this check-in might end up on an abandoned branch at some point. by drh on 2008-03-06 22:58:48. [view]

To:

File src/content.c part of check-in [8010bb41e1] - Speed enhancement in the findSrcid() routine of content.c. Allow 5 digit numbers on counts while syncing. by drh on 2008-03-08 18:59:00. [view]

@@ -82,9 +82,18 @@
 ** Return the srcid associated with rid.  Or return 0 if rid is
 ** original content and not a delta.
 */
 static int findSrcid(int rid){
-  int srcid = db_int(0, "SELECT srcid FROM delta WHERE rid=%d", rid);
+  static Stmt q;
+  int srcid;
+  db_static_prepare(&q, "SELECT srcid FROM delta WHERE rid=:rid");
+  db_bind_int(&q, ":rid", rid);
+  if( db_step(&q)==SQLITE_ROW ){
+    srcid = db_column_int(&q, 0);
+  }else{
+    srcid = 0;
+  }
+  db_reset(&q);
   return srcid;
 }
 
 /*