Commit 7c6609d2 authored by Steven Murray's avatar Steven Murray
Browse files

[catalogue] cta/CTA#951 Fixed

parent 6dbbb59f
......@@ -83,42 +83,128 @@ RdbmsCatalogueTapeContentsItor::RdbmsCatalogueTapeContentsItor(
if (vid.empty()) throw exception::Exception("vid is an empty string");
std::string sql =
"SELECT /*+ INDEX (TAPE_FILE TAPE_FILE_VID_IDX) */" "\n"
"ARCHIVE_FILE.ARCHIVE_FILE_ID AS ARCHIVE_FILE_ID," "\n"
"ARCHIVE_FILE.DISK_INSTANCE_NAME AS DISK_INSTANCE_NAME," "\n"
"ARCHIVE_FILE.DISK_FILE_ID AS DISK_FILE_ID," "\n"
"ARCHIVE_FILE.DISK_FILE_UID AS DISK_FILE_UID," "\n"
"ARCHIVE_FILE.DISK_FILE_GID AS DISK_FILE_GID," "\n"
"ARCHIVE_FILE.SIZE_IN_BYTES AS SIZE_IN_BYTES," "\n"
"ARCHIVE_FILE.CHECKSUM_BLOB AS CHECKSUM_BLOB," "\n"
"ARCHIVE_FILE.CHECKSUM_ADLER32 AS CHECKSUM_ADLER32," "\n"
"STORAGE_CLASS.STORAGE_CLASS_NAME AS STORAGE_CLASS_NAME," "\n"
"ARCHIVE_FILE.CREATION_TIME AS ARCHIVE_FILE_CREATION_TIME," "\n"
"ARCHIVE_FILE.RECONCILIATION_TIME AS RECONCILIATION_TIME," "\n"
"TAPE_FILE.VID AS VID," "\n"
"TAPE_FILE.FSEQ AS FSEQ," "\n"
"TAPE_FILE.BLOCK_ID AS BLOCK_ID," "\n"
"TAPE_FILE.LOGICAL_SIZE_IN_BYTES AS LOGICAL_SIZE_IN_BYTES," "\n"
"TAPE_FILE.COPY_NB AS COPY_NB," "\n"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME," "\n"
"TAPE_FILE.SUPERSEDED_BY_VID AS SUPERSEDED_BY_VID," "\n"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SUPERSEDED_BY_FSEQ," "\n"
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"INNER JOIN STORAGE_CLASS ON" "\n"
"ARCHIVE_FILE.STORAGE_CLASS_ID = STORAGE_CLASS.STORAGE_CLASS_ID" "\n"
"INNER JOIN TAPE_FILE ON" "\n"
"ARCHIVE_FILE.ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
"INNER JOIN TAPE ON" "\n"
"TAPE_FILE.VID = TAPE.VID" "\n"
"INNER JOIN TAPE_POOL ON" "\n"
"TAPE.TAPE_POOL_ID = TAPE_POOL.TAPE_POOL_ID" "\n"
"WHERE" "\n"
"TAPE_FILE.VID = :VID" "\n";
"SELECT" "\n"
"TAPE_FILE.ARCHIVE_FILE_ID AS ARCHIVE_FILE_ID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_INSTANCE_NAME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_INSTANCE_NAME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_ID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_ID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_UID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_UID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_GID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_GID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.SIZE_IN_BYTES" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS SIZE_IN_BYTES," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CHECKSUM_BLOB" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS CHECKSUM_BLOB," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CHECKSUM_ADLER32" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS CHECKSUM_ADLER32," "\n"
"(" "\n"
"SELECT" "\n"
"STORAGE_CLASS.STORAGE_CLASS_NAME" "\n"
"FROM" "\n"
"STORAGE_CLASS" "\n"
"WHERE" "\n"
"STORAGE_CLASS.STORAGE_CLASS_ID =" "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.STORAGE_CLASS_ID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
")" "\n"
") AS STORAGE_CLASS_NAME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CREATION_TIME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS ARCHIVE_FILE_CREATION_TIME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.RECONCILIATION_TIME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS RECONCILIATION_TIME," "\n"
"TAPE_FILE.VID AS VID," "\n"
"TAPE_FILE.FSEQ AS FSEQ," "\n"
"TAPE_FILE.BLOCK_ID AS BLOCK_ID," "\n"
"TAPE_FILE.LOGICAL_SIZE_IN_BYTES AS LOGICAL_SIZE_IN_BYTES," "\n"
"TAPE_FILE.COPY_NB AS COPY_NB," "\n"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME," "\n"
"TAPE_FILE.SUPERSEDED_BY_VID AS SUPERSEDED_BY_VID," "\n"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SUPERSEDED_BY_FSEQ," "\n"
"(" "\n"
"SELECT" "\n"
"TAPE_POOL_NAME" "\n"
"FROM" "\n"
"TAPE_POOL" "\n"
"WHERE" "\n"
"TAPE_POOL.TAPE_POOL_ID =" "\n"
"(" "\n"
"SELECT" "\n"
"TAPE_POOL_ID" "\n"
"FROM" "\n"
"TAPE" "\n"
"WHERE" "\n"
"TAPE.VID = TAPE_FILE.VID" "\n"
")" "\n"
") AS TAPE_POOL_NAME" "\n"
"FROM" "\n"
"TAPE_FILE" "\n"
"WHERE" "\n"
"TAPE_FILE.VID = :VID" "\n";
if (!showSuperseded) {
sql += "AND TAPE_FILE.SUPERSEDED_BY_VID IS NULL" "\n";
sql +=
"AND TAPE_FILE.SUPERSEDED_BY_VID IS NULL\n";
}
sql += "ORDER BY FSEQ";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment