Commit 5e9bd025 authored by Marco De Marco's avatar Marco De Marco
Browse files

Dec fix

parent bc18e08d
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -331,21 +331,21 @@ void WorkerThread::execQuery(ConnectionManager::SessionSP session_sp,
	valuesQuery << "VALUES(";

	//Append storage path column to query
	insertQuery << "storage_path";
	insertQuery << destination_sp->getTable() << ".storage_path";
	valuesQuery << "\'" << destination_sp->getStoragePath() << "\'";

	//Append file path column to query
	insertQuery << ",file_path";
	insertQuery << "," << destination_sp->getTable() << ".file_path";
	int month = date.month();
	valuesQuery << ",\'/" << destination_sp->getDirName() << "/"
        << date.year() << "/" << month << "/" << date.day() << "\'";

	//Append file version column to query
	insertQuery << ",file_version";
	insertQuery << "," << destination_sp->getTable()  << ".file_version";
	valuesQuery << "," << duplicateMax;

	//Append file name in column to query
	insertQuery << ",file_name";
	insertQuery << "," << destination_sp->getTable()  << ".file_name";

	valuesQuery << ",\'" << origPath.filename().string() << ".gz\'";

@@ -360,7 +360,8 @@ void WorkerThread::execQuery(ConnectionManager::SessionSP session_sp,
			//Search for primary fits key
			value = readKey(phdu, (*it)->getFitsPrimary(), (*it)->getColumnType());

			insertQuery << "," << (*it)->getColumnName();
			insertQuery << "," << destination_sp->getTable() << "."
                    << (*it)->getColumnName();
			valuesQuery << "," << value;
		}
		catch(CCfits::HDU::NoSuchKeyword& ex)
@@ -372,7 +373,8 @@ void WorkerThread::execQuery(ConnectionManager::SessionSP session_sp,
				//Search for secondary fits key (alias)
				value = readKey(phdu, (*it)->getFitsSecondary(), (*it)->getColumnType());

				insertQuery << "," << (*it)->getColumnName();
				insertQuery << "," << destination_sp->getTable() << "."
                    << (*it)->getColumnName();
				valuesQuery << "," << value;
			}
			catch(CCfits::HDU::NoSuchKeyword& ex)
@@ -405,10 +407,10 @@ std::string WorkerThread::readKey(CCfits::PHDU& phdu, std::string keyName,

    std::stringstream result_stream;

    boost::regex pattern("^(NAXIS)([0-9]+)$");
    boost::regex pattern("^(NAXIS)([0-9]+)$", boost::regex::icase);
    boost::smatch matches;

    if(keyName.compare("NAXIS")==0)
    if(keyName.compare("NAXIS")==0 || keyName.compare("naxis")==0)
    {
        result_stream << phdu.axes();
    }
@@ -430,19 +432,19 @@ std::string WorkerThread::readKey(CCfits::PHDU& phdu, std::string keyName,
            throw std::runtime_error("Exception parsing naxis number");
        }
    }
    else if(keyName.compare("BITPIX")==0)
    else if(keyName.compare("BITPIX")==0 || keyName.compare("bitpix")==0)
    {
        result_stream << phdu.bitpix();
    }
    else if(keyName.compare("BSCALE")==0)
    else if(keyName.compare("BSCALE")==0 || keyName.compare("bscale")==0)
    {
        result_stream << phdu.scale();
    }
    else if(keyName.compare("BZERO")==0)
    else if(keyName.compare("BZERO")==0 || keyName.compare("bzero")==0)
    {
        result_stream << phdu.zero();
    }
    else if(keyName.compare("EXTEND")==0)
    else if(keyName.compare("EXTEND")==0 || keyName.compare("extend")==0)
    {
        result_stream << phdu.extend();
    }