From 7b076faf9171f32a31f2d56954027021c8734ef4 Mon Sep 17 00:00:00 2001 From: Marco De Marco <demarco@oats.inaf.it> Date: Tue, 14 Jan 2014 16:01:45 +0100 Subject: [PATCH] Basic file transfer works --- src/DBManager.cpp | 3 ++- src/ProtocolManager.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/DBManager.cpp b/src/DBManager.cpp index 1bd0a60..f308f79 100644 --- a/src/DBManager.cpp +++ b/src/DBManager.cpp @@ -136,7 +136,8 @@ boost::posix_time::ptime DBManager::retrieveLastTimestamp() std::tm tm_time; - *m_auxSession_sp << "select coalesce(last_timestamp,'1970-01-01 00:00:00')" + //FIXME: max return null, otherwise coalesce does not work + *m_auxSession_sp << "select coalesce(max(last_timestamp),'1970-01-01 00:00:00')" << " from "<< m_configuration_sp->getAuxDatabaseSchema() << "." << m_configuration_sp->getAuxDatabaseTimestampTable() << " where device_name like :deviceName", diff --git a/src/ProtocolManager.cpp b/src/ProtocolManager.cpp index 8a9e196..9a3cc45 100644 --- a/src/ProtocolManager.cpp +++ b/src/ProtocolManager.cpp @@ -131,7 +131,7 @@ RequestSP ProtocolManager::createRequest() throw(std::runtime_error) { DEBUG_STREAM << "ProtocolManager::createNewFileRequest()" << endl; - if(hasNewFile()) + if(!hasNewFile()) throw std::runtime_error("New file list is empty"); RequestSP request_sp(new Request); @@ -197,8 +197,10 @@ FileWrapper::SP ProtocolManager::processResponse(ResponseSP response_sp) << " transfer file " << fileName << " version " << fileVersion << " size " << fileSize << endl; - boost::filesystem::path path = composePath(m_configuration_sp->getStoragePath(), - filePath, fileVersion, fileName); +// boost::filesystem::path path = composePath(m_configuration_sp->getStoragePath(), +// filePath, fileVersion, fileName); + + boost::filesystem::path path(fileName); return FileWrapper::create(m_deviceImpl_p, path, fileSize); } -- GitLab