Przeglądaj źródła

Don't miss to read the fileid from database.

Klaas Freitag 12 lat temu
rodzic
commit
c22758201f
2 zmienionych plików z 9 dodań i 3 usunięć
  1. 5 2
      src/csync_dbtree.c
  2. 4 1
      src/csync_statedb.c

+ 5 - 2
src/csync_dbtree.c

@@ -71,7 +71,7 @@ csync_vio_method_handle_t *csync_dbtree_opendir(CSYNC *ctx, const char *name)
        "md5 VARCHAR(32),"  // That's the etag
      */
 
-    int col_count = 9;
+    int col_count = 10;
     if( strlen(name) < strlen(ctx->remote.uri)+1) {
         CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "name does not contain remote uri!");
         return NULL;
@@ -177,10 +177,13 @@ csync_vio_method_handle_t *csync_dbtree_opendir(CSYNC *ctx, const char *name)
         }
         fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
 
-        column = list->vector[base+8]; /* type     */
+        column = list->vector[base+8]; /* etag */
         fs->etag = csync_normalize_etag(column);
         fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG;
 
+        column = list->vector[base+9]; /* file id */
+        csync_vio_file_stat_set_file_id(fs, column);
+
         /* store into result list. */
         listing->list = c_list_append( listing->list, fs );
         listing->cnt++;

+ 4 - 1
src/csync_statedb.c

@@ -394,6 +394,9 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(sqlite3 *db,
       if(column_count > 9 && sqlite3_column_text(_by_hash_stmt, 9)) {
         st->etag = csync_normalize_etag( (char*) sqlite3_column_text(_by_hash_stmt, 9) );
       }
+      if(column_count > 10 && sqlite3_column_text(_by_hash_stmt,10)) {
+          csync_vio_set_file_id(st->file_id, (char*) sqlite3_column_text(_by_hash_stmt, 10));
+      }
     }
   } else {
     /* SQLITE_DONE says there is no further row. That's not an error. */
@@ -557,7 +560,7 @@ c_strlist_t *csync_statedb_get_below_path( CSYNC *ctx, const char *path ) {
     c_strlist_t *list = NULL;
     char *stmt = NULL;
 
-    stmt = sqlite3_mprintf("SELECT phash, path, inode, uid, gid, mode, modtime, type, md5 "
+    stmt = sqlite3_mprintf("SELECT phash, path, inode, uid, gid, mode, modtime, type, md5, fileid "
                            "FROM metadata WHERE path LIKE('%q/%%')", path);
     if (stmt == NULL) {
       return NULL;