+bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
bool db_create_base_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
bool db_commit_base_file_attributes_record(JCR *jcr, B_DB *mdb);
void db_cleanup_base_file(JCR *jcr, B_DB *mdb);
"Name TEXT)"
};
+/*
+ * Create file attributes record, or base file attributes record
+ */
+bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+{
+ bool ret;
+ if (ar->FileType == FT_BASE) {
+ ret = db_create_base_file_attributes_record(jcr, mdb, ar);
+ } else {
+ ret = db_create_file_attributes_record(jcr, mdb, ar);
+ }
+
+ return ret;
+}
+
/*
* Create Base File record in B_DB
*
Mmsg(mdb->cmd, "INSERT INTO basefile%lld (Path, Name) VALUES ('%s','%s')",
(uint64_t)jcr->JobId, mdb->esc_path, mdb->esc_name);
-
+ Dmsg1(0, "%s\n", mdb->cmd);
+
ret = INSERT_DB(jcr, mdb, mdb->cmd);
db_unlock(mdb);
"AND A.Name = B.Name "
"ORDER BY B.FileId)",
edit_uint64(jcr->JobId, ed1), ed1, ed1);
-
+ Dmsg1(0, "%s\n", buf.c_str());
return db_sql_query(mdb, buf.c_str(), NULL, NULL);
}
if (Stream == STREAM_UNIX_ATTRIBUTES || Stream == STREAM_UNIX_ATTRIBUTES_EX) {
if (jcr->cached_attribute) {
Dmsg2(400, "Cached attr. Stream=%d fname=%s\n", ar->Stream, ar->fname);
- if (!db_create_file_attributes_record(jcr, jcr->db, ar)) {
+ if (!db_create_attributes_record(jcr, jcr->db, ar)) {
Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
}
}
skip_nonspaces(&p); /* skip FileIndex */
skip_spaces(&p);
ar->FileType = str_to_int32(p); /* TODO: choose between unserialize and str_to_int32 */
+ Dmsg1(0, "FileType=%i\n", ar->FileType);
skip_nonspaces(&p); /* skip FileType */
skip_spaces(&p);
fname = p;
ar->Stream, ar->fname);
/* Update BaseFile table */
- if (ar->FileType == FT_BASE) {
- if (!db_create_base_file_attributes_record(jcr, jcr->db, ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Base attribute create error. %s"),
+ if (!db_create_attributes_record(jcr, jcr->db, ar)) {
+ Jmsg1(jcr, M_FATAL, 0, _("attribute create error. %s"),
db_strerror(jcr->db));
- }
-
- } else { /* Regular files */
- if (!db_create_file_attributes_record(jcr, jcr->db, ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"),
- db_strerror(jcr->db));
- }
}
-
jcr->cached_attribute = false;
} else {
if (!db_add_digest_to_file_record(jcr, jcr->db, ar->FileId, digestbuf, type)) {
ff_pkt->type = FT_BASE;
foreach_htable(elt, jcr->file_list) {
- if (!elt->seen || !plugin_check_file(jcr, elt->fname)) {
- continue;
+ if (elt->seen) {
+ Dmsg2(0, "base file fname=%s seen=%i\n", elt->fname, elt->seen);
+ ff_pkt->fname = elt->fname;
+ ff_pkt->statp.st_mtime = elt->mtime;
+ ff_pkt->statp.st_ctime = elt->ctime;
+ encode_and_send_attributes(jcr, ff_pkt, stream);
+// free(elt->fname);
}
- Dmsg2(dbglvl, "base file fname=%s seen=%i\n", elt->fname, elt->seen);
- ff_pkt->fname = elt->fname;
- ff_pkt->statp.st_mtime = elt->mtime;
- ff_pkt->statp.st_ctime = elt->ctime;
- encode_and_send_attributes(jcr, ff_pkt, stream);
-// free(elt->fname);
}
term_find_files(ff_pkt);