POOL_MEM query;
- Mmsg(query,// 1 2 3
-"SELECT 'V', File.PathId, File.FilenameId, File.JobId, "
-// 4 5 6
+ Mmsg(query,// 1 2 3 4
+"SELECT 'V', File.PathId, File.FilenameId, 0, File.JobId, "
+// 5 6 7
"File.LStat, File.FileId, File.Md5, "
-// 7 8
- "Media.VolumeName, Media.InChanger "
+// 8 9
+ "Media.VolumeName, Media.InChanger "
"FROM File, Job, Client, JobMedia, Media "
"WHERE File.FilenameId = %s "
"AND File.PathId=%s "
edit_uint64(pwd_id, ed1), jobids, ed1);
POOL_MEM query2;
- Mmsg(query2,// 1 2 3 4 5
-"SELECT 'D', tmp.PathId, tmp.Path, JobId, LStat, FileId, FileIndex "
+ Mmsg(query2,// 1 2 3 4 5 6
+"SELECT 'D', tmp.PathId, 0, tmp.Path, JobId, LStat, FileId, FileIndex "
"FROM %s AS tmp LEFT JOIN ( " // get attributes if any
"SELECT File1.PathId AS PathId, File1.JobId AS JobId, "
"File1.LStat AS LStat, File1.FileId AS FileId, "
/* Then we get all the dir entries from File ... */
Mmsg(query,
// 0 1 2 3 4 5 6
-"SELECT 'D', PathId, Path, JobId, LStat, FileId, FileIndex FROM ( "
+"SELECT 'D', PathId, 0, Path, JobId, LStat, FileId, FileIndex FROM ( "
"SELECT Path1.PathId AS PathId, Path1.Path AS Path, "
"lower(Path1.Path) AS lpath, "
"listfile1.JobId AS JobId, listfile1.LStat AS LStat, "
if (*fileid) { /* Select files with their direct id */
init=true;
- Mmsg(tmp,"SELECT Job.JobId, JobTDate, FileIndex, Filename.Name, "
+ Mmsg(tmp,"SELECT Job.JobId, JobTDate, FileIndex, FilenameId, "
"PathId, FileId "
- "FROM File,Job,Filename WHERE Job.JobId=File.Jobid "
- "AND File.FilenameId=Filename.FilenameId AND FileId IN (%s)",
+ "FROM File,Job WHERE Job.JobId=File.Jobid "
+ "AND FileId IN (%s)",
fileid);
pm_strcat(query, tmp.c_str());
}
typedef enum {
BVFS_Type = 0, /* Could be D, F, V, L */
BVFS_PathId = 1,
- BVFS_FilenameId = 5,
+ BVFS_FilenameId = 2,
- BVFS_Name = 2,
- BVFS_JobId = 3,
+ BVFS_Name = 3, /* Can be empty for File version */
+ BVFS_JobId = 4,
- BVFS_LStat = 4, /* Can be empty for missing directories */
- BVFS_FileId = 5, /* Can be empty for missing directories */
+ BVFS_LStat = 5, /* Can be empty for missing directories */
+ BVFS_FileId = 6, /* Can be empty for missing directories */
/* Only if Path record */
- BVFS_FileIndex = 6,
+ BVFS_FileIndex = 7,
/* Only if File Version record */
- BVFS_Md5 = 6,
- BVFS_VolName = 7,
- BVFS_VolInchanger = 8,
+ BVFS_Md5 = 7,
+ BVFS_VolName = 8,
+ BVFS_VolInchanger = 9,
/* Only if Delta record */
BVFS_DeltaSeq = 6,
};
static const char *sql_bvfs_list_files_default =
-"SELECT 'F', T1.PathId, Filename.Name, "
+"SELECT 'F', T1.PathId, T1.FilenameId, Filename.Name, "
"File.JobId, File.LStat, File.FileId "
"FROM Job, File, ( "
"SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId "
/* JobId PathId JobId PathId WHERE? Filename? Limit Offset*/
/* Postgresql */
- "SELECT Type, PathId, Name, JobId, LStat, FileId "
+ "SELECT Type, PathId, FilenameId, Name, JobId, LStat, FileId "
"FROM ("
"SELECT DISTINCT ON (FilenameId) 'F' as Type, PathId, T.FilenameId, "
"Filename.Name, JobId, LStat, FileId, FileIndex "