Commit fc7961ba authored by Marco De Marco's avatar Marco De Marco
Browse files

File path date padding with zero fix

parent 71a93a6b
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@


#include <cassert>
#include <cassert>
#include <fstream>
#include <fstream>
#include <iomanip>


#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
@@ -431,8 +432,10 @@ std::string WorkerThread::composeQuery(Destination::SP destination_sp,
	//Append file path column to query
	//Append file path column to query
	insertQuery << "," << destination_sp->getTable() << ".file_path";
	insertQuery << "," << destination_sp->getTable() << ".file_path";
	int month = date.month();
	int month = date.month();
	valuesQuery << ",\'/" << date.year() << "/" << month << "/" << date.day()
	valuesQuery << ",\'/" << date.year();
        << "/" << destination_sp->getDirName() << "\'";
    valuesQuery << "/" << std::setw(2) << std::setfill('0') << month;
    valuesQuery << "/" << std::setw(2) << std::setfill('0') << date.day();
    valuesQuery << "/" << destination_sp->getDirName() << "\'";


	//Append file version column to query
	//Append file version column to query
	insertQuery << "," << destination_sp->getTable()  << ".file_version";
	insertQuery << "," << destination_sp->getTable()  << ".file_version";
@@ -774,8 +777,10 @@ boost::filesystem::path WorkerThread::createDestPath(boost::filesystem::path& or
	//Create directory path, date and version part of destination path
	//Create directory path, date and version part of destination path
	std::stringstream relPathStream;
	std::stringstream relPathStream;
	int month = date.month();
	int month = date.month();
	relPathStream << "/" << date.year() << "/" << month << "/" << date.day()
	relPathStream << "/" << date.year();
		<< "/" << destination_sp->getDirName() << "/" << duplicateMax;
    relPathStream << "/" << std::setw(2) << std::setfill('0') << month ;
    relPathStream << "/" << std::setw(2) << std::setfill('0') << date.day();
	relPathStream << "/" << destination_sp->getDirName() << "/" << duplicateMax;
	boost::filesystem::path relPath( relPathStream.str() );
	boost::filesystem::path relPath( relPathStream.str() );


	//Append date path to full destination path
	//Append date path to full destination path