Diff
Not logged in

Differences From:

File src/vfile.c part of check-in [3ed9214338] - Fix a bug in the manifest parser so that it is able to parse the PGP headers even if the header contains \r characters. by drh on 2007-09-22 19:32:21. Also file src/vfile.c part of check-in [d0305b305a] - Merged mainline into my branch to get the newest application. by aku on 2007-12-05 08:07:46. [view]

To:

File src/vfile.c part of check-in [043d63d4aa] - Additional speed improvements for clone and rebuild. by drh on 2008-03-08 19:42:53. [view]

@@ -40,8 +40,9 @@
 ** create a phantom record.
 */
 int uuid_to_rid(const char *zUuid, int phantomize){
   int rid, sz;
+  static Stmt q;
   char z[UUID_SIZE+1];
 
   sz = strlen(zUuid);
   if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){
@@ -48,11 +49,18 @@
     return 0;
   }
   strcpy(z, zUuid);
   canonical16(z, sz);
-  rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", z);
+  db_static_prepare(&q, "SELECT rid FROM blob WHERE uuid=:uuid");
+  db_bind_text(&q, ":uuid", z);
+  if( db_step(&q)==SQLITE_ROW ){
+    rid = db_column_int(&q, 0);
+  }else{
+    rid = 0;
+  }
+  db_reset(&q);
   if( rid==0 && phantomize ){
-    rid = content_put(0, zUuid, 0);
+    rid = content_new(zUuid);
   }
   return rid;
 }