#endif /* HAVE_BATCH_FILE_INSERT */
-/* Create a new record for the Job
- * Returns: false on failure
+/** Create a new record for the Job
+ * Returns: false on failure
* true on success
*/
bool
}
-/* Create a JobMedia record for medium used this job
- * Returns: false on failure
+/** Create a JobMedia record for medium used this job
+ * Returns: false on failure
* true on success
*/
bool
}
count++;
- /* Note, jm->Strip is not used and is not likely to be used
- * in the near future, so I have removed it from the insert
- * to save space in the DB. KES June 2006.
- */
Mmsg(mdb->cmd,
"INSERT INTO JobMedia (JobId,MediaId,FirstIndex,LastIndex,"
"StartFile,EndFile,StartBlock,EndBlock,VolIndex) "
return ok;
}
-/* Create Unique Pool record
- * Returns: false on failure
+/** Create Unique Pool record
+ * Returns: false on failure
* true on success
*/
bool
return stat;
}
-/*
+/**
* Create Unique Device record
* Returns: false on failure
* true on success
-/*
+/**
* Create a Unique record for Storage -- no duplicates
* Returns: false on failure
* true on success with id in sr->StorageId
}
-/*
+/**
* Create Unique MediaType record
* Returns: false on failure
* true on success
}
-/*
+/**
* Create Media record. VolumeName and non-zero Slot must be unique
*
* Returns: 0 on failure
return stat;
}
-/*
+/**
* Create a Unique record for the client -- no duplicates
* Returns: 0 on failure
* 1 on success with id in cr->ClientId
}
-/* Create a Unique record for the Path -- no duplicates */
+/** Create a Unique record for the Path -- no duplicates */
int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
SQL_ROW row;
return stat;
}
-/*
+/**
* Create a Unique record for the counter -- no duplicates
* Returns: 0 on failure
* 1 on success with counter filled in
}
-/*
+/**
* Create a FileSet record. This record is unique in the
* name and the MD5 signature of the include/exclude sets.
* Returns: 0 on failure
}
-/*
+/**
* struct stat
* {
* dev_t st_dev; * device *
#ifdef HAVE_BATCH_FILE_INSERT
-/* All sql_batch_* functions are used to do bulk batch insert in File/Filename/Path
+/** All sql_batch_* functions are used to do bulk batch insert in File/Filename/Path
* tables. This code can be activated by adding "#define HAVE_BATCH_FILE_INSERT 1"
* in baconfig.h
*
return true;
}
-/*
+/**
* Create File record in B_DB
*
* In order to reduce database size, we store the File attributes,
#else /* ! HAVE_BATCH_FILE_INSERT */
-/*
+/**
* Create File record in B_DB
*
* In order to reduce database size, we store the File attributes,
}
-/*
+/**
* This is the master File entry containing the attributes.
* The filename and path records have already been created.
*/
return stat;
}
-/* Create a Unique record for the filename -- no duplicates */
+/** Create a Unique record for the filename -- no duplicates */
static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
SQL_ROW row;
#endif /* ! HAVE_BATCH_FILE_INSERT */
-
-/* List of SQL commands to create temp table and indicies */
-const char *create_temp_basefile[5] = {
- /* MySQL */
- "CREATE TEMPORARY TABLE basefile%lld ("
-// "CREATE TABLE basefile%lld ("
- "Path BLOB NOT NULL,"
- "Name BLOB NOT NULL)",
-
- /* Postgresql */
- "CREATE TEMPORARY TABLE basefile%lld ("
-// "CREATE TABLE basefile%lld ("
- "Path TEXT,"
- "Name TEXT)",
-
- /* SQLite */
- "CREATE TEMPORARY TABLE basefile%lld ("
- "Path TEXT,"
- "Name TEXT)",
-
- /* SQLite3 */
- "CREATE TEMPORARY TABLE basefile%lld ("
- "Path TEXT,"
- "Name TEXT)",
-
- /* Ingres */
- "DECLARE GLOBAL TEMPORARY TABLE basefile%lld ("
- "Path TEXT NOT NULL,"
- "Name TEXT NOT NULL)"
- "ON COMMIT PRESERVE ROWS WITH NORECOVERY"
-};
-
-/*
+/**
* Create file attributes record, or base file attributes record
*/
bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
return ret;
}
-/*
+/**
* Create Base File record in B_DB
*
*/
return ret;
}
-/*
+/**
* Cleanup the base file temporary tables
*/
static void db_cleanup_base_file(JCR *jcr, B_DB *mdb)
db_sql_query(mdb, buf.c_str(), NULL, NULL);
}
-/*
+/**
* Put all base file seen in the backup to the BaseFile table
* and cleanup temporary tables
*/
return ret;
}
-/*
+/**
* Find the last "accurate" backup state with Base jobs
* 1) Get all files with jobid in list (F subquery)
* 2) Take only the last version of each file (Temp subquery) => accurate list is ok
goto bail_out;
}
Mmsg(buf, select_recent_version[db_type], jobids, jobids);
- Mmsg(mdb->cmd,
-"CREATE TEMPORARY TABLE new_basefile%lld AS "
-//"CREATE TABLE new_basefile%lld AS "
- "SELECT Path.Path AS Path, Filename.Name AS Name, Temp.FileIndex AS FileIndex,"
- "Temp.JobId AS JobId, Temp.LStat AS LStat, Temp.FileId AS FileId, "
- "Temp.MD5 AS MD5 "
- "FROM ( %s ) AS Temp "
- "JOIN Filename ON (Filename.FilenameId = Temp.FilenameId) "
- "JOIN Path ON (Path.PathId = Temp.PathId) "
- "WHERE Temp.FileIndex > 0",
- (uint64_t)jcr->JobId, buf.c_str());
+ Mmsg(mdb->cmd, create_temp_new_basefile[db_type], (uint64_t)jcr->JobId, buf.c_str());
ret = db_sql_query(mdb, mdb->cmd, NULL, NULL);
bail_out:
return ret;
}
-
-/*
+/**
* Create Restore Object record in B_DB
*
*/
POOLMEM *esc_obj = get_pool_memory(PM_MESSAGE);
db_lock(mdb);
- Dmsg1(dbglevel, "Fname=%s\n", ro->fname);
+ Dmsg1(dbglevel, "Oname=%s\n", ro->object_name);
Dmsg0(dbglevel, "put_object_into_catalog\n");
- split_path_and_file(jcr, mdb, ro->full_fname);
-
+ mdb->fnl = strlen(ro->object_name);
mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1);
- db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
+ db_escape_string(jcr, mdb, mdb->esc_name, ro->object_name, mdb->fnl);
- mdb->esc_path = check_pool_memory_size(mdb->esc_path, mdb->pnl*2+1);
- db_escape_string(jcr, mdb, mdb->esc_path, mdb->path, mdb->pnl);
-
esc_obj = check_pool_memory_size(esc_obj, ro->object_len*2+1);
db_escape_string(jcr, mdb, esc_obj, ro->object, ro->object_len);
Mmsg(mdb->cmd,
- "INSERT INTO RestoreObject (Fname,Path,PluginName,RestoreObject,"
- "ObjectIndex,ObjectType,FileIndex,JobId) VALUES"
- "('%s','%s','%s','%s',%d,%d,%d,%u)",
- mdb->esc_name, mdb->esc_path, mdb->esc_path, esc_obj, ro->object_len,
- ro->ObjectIndex, FT_RESTORE_FIRST, ro->FileIndex, ro->JobId);
+ "INSERT INTO RestoreObject (ObjectName,RestoreObject,"
+ "ObjectLength,ObjectIndex,ObjectType,ObjectCompression,FileIndex,JobId) "
+ "VALUES ('%s','%s',%d,%d,%d,%d,%d,%u)",
+ mdb->esc_name, esc_obj, ro->object_len, ro->object_index,
+ FT_RESTORE_FIRST, ro->object_compression, ro->FileIndex, ro->JobId);
ro->RestoreObjectId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("RestoreObject"));
if (ro->RestoreObjectId == 0) {