Fossil

Diff
Login

Diff

Differences From Artifact [ac96ad6edd]:

To Artifact [15d6dff0f1]:


54
55
56
57
58
59
60



61








62
63

64
65
66
67
68
69
70
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80







+
+
+
-
+
+
+
+
+
+
+
+

-
+







** Create a phantom record if no prior record exists and
** phantomize is true.
**
** Compare to uuid_to_rid().  This routine takes a blob argument
** and does less error checking.
*/
static int rid_from_uuid(Blob *pUuid, int phantomize){
  static Stmt q;
  int rid;

  int rid = db_int(0, "SELECT rid FROM blob WHERE uuid='%b'", pUuid);
  db_static_prepare(&q, "SELECT rid FROM blob WHERE uuid=:uuid");
  db_bind_str(&q, ":uuid", pUuid);
  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, blob_str(pUuid), 0);
    rid = content_new(blob_str(pUuid));
  }
  return rid;
}

/*
** Remember that the other side of the connection already has a copy
** of the file rid.
838
839
840
841
842
843
844
845
846


847
848
849
850


851
852
853
854
855
856
857
858
859
860
861
848
849
850
851
852
853
854


855
856




857
858




859
860
861
862
863
864
865







-
-
+
+
-
-
-
-
+
+
-
-
-
-







      ** Always remember that the server has this file so that we do
      ** not transmit it by accident.
      */
      if( xfer.nToken==2
       && blob_eq(&xfer.aToken[0], "igot")
       && blob_is_uuid(&xfer.aToken[1])
      ){
        int rid = 0;
        if( pullFlag || cloneFlag ){
        int rid = rid_from_uuid(&xfer.aToken[1], 0);
        if( rid==0 && (pullFlag || cloneFlag) ){
          if( !db_exists("SELECT 1 FROM blob WHERE uuid='%b' AND size>=0",
                &xfer.aToken[1]) ){
            rid = content_put(0, blob_str(&xfer.aToken[1]), 0);
            newPhantom = 1;
          rid = content_new(blob_str(&xfer.aToken[1]));
          newPhantom = 1;
          }
        }
        if( rid==0 ){
          rid = rid_from_uuid(&xfer.aToken[1], 0);
        }
        remote_has(rid);
      }else
    
      
      /*   push  SERVERCODE  PRODUCTCODE
      **