1
0
This commit is contained in:
Scott E. Graves
2017-03-15 23:19:46 -05:00
parent cba53aef8b
commit 72caad98d2
5 changed files with 43 additions and 9 deletions

View File

@@ -23,7 +23,6 @@ if (MSVC OR MINGW)
endif()
if (MSVC)
add_definitions(-DCURL_STATICLIB=ON -DCURL_DISABLE_LDAP=ON)
ExternalProject_Add(curl_project
URL https://github.com/curl/curl/archive/curl-7_53_1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}/external/builds/curl
@@ -32,16 +31,17 @@ if (MSVC)
ExternalProject_Add(sqlitecpp_project
URL https://github.com/SRombauts/SQLiteCpp/archive/2.0.0.tar.gz
PREFIX ${CMAKE_BINARY_DIR}/external/builds/sqlitecpp
CMAKE_ARGS -DSQLITECPP_RUN_CPPLINT=OFF -DSQLITECPP_RUN_CPPCHECK=OFF
INSTALL_COMMAND cmake -E echo "Skipping install step.")
add_definitions(-DCURL_STATICLIB=ON -DCURL_DISABLE_LDAP=ON)
add_dependencies(siadrive.api curl_project sqlitecpp_project)
set(3RD_PARTY_INCLUDES ${3RD_PARTY_INCLUDES} ${CMAKE_BINARY_DIR}/external/include ${CMAKE_BINARY_DIR}/external/builds/sqlitecpp/src/sqlitecpp_project/include/)
set(3RD_PARTY_INCLUDES ${3RD_PARTY_INCLUDES} ${CMAKE_BINARY_DIR}/external/include ${CMAKE_BINARY_DIR}/external/builds/sqlitecpp/src/sqlitecpp_project/sqlite3 ${CMAKE_BINARY_DIR}/external/builds/sqlitecpp/src/sqlitecpp_project/include/)
target_link_libraries(siadrive.api
${CMAKE_BINARY_DIR}/external/lib/libcurl.lib
${CMAKE_BINARY_DIR}/external/lib/libcurl.lib
${CMAKE_BINARY_DIR}/external/builds/sqlitecpp/src/sqlitecpp_project-build/sqlite3/${CMAKE_BUILD_TYPE}/sqlite3.lib
${CMAKE_BINARY_DIR}/external/builds/sqlitecpp/src/sqlitecpp_project-build/${CMAKE_BUILD_TYPE}/SQLiteCpp.lib)
set_property(TARGET siadrive.api APPEND PROPERTY LINK_FLAGS /OPT:NOREF)
endif()

8
build_debug_x64.cmd Normal file
View File

@@ -0,0 +1,8 @@
@echo off
mkdir build
pushd build
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Debug ..
popd

View File

@@ -1,9 +1,9 @@
#ifndef _UPLOADMANAGER_H
#define _UPLOADMANAGER_H
#include <autothread.h>
#include <SQLiteCpp/Database.h>
#include <SQLiteCpp/Exception.h>
#include <autothread.h>
#include <deque>
#include <siacurl.h>
#include <eventsystem.h>
@@ -873,7 +873,7 @@ public:
virtual SString GetSingleLineMessage() const override
{
return L"DatabaseExceptionOccurred|MSG|" + SString(_exception.getErrorStr());
return L"DatabaseExceptionOccurred|MSG|" + SString();// _exception.getErrorStr());
}
};

View File

@@ -1,8 +1,32 @@
#include <siacommon.h>
#include <ttmath/ttmath.h>
#include <SQLiteCpp/Exception.h>
#include <sqlite3.h>
#ifdef _WIN32
#include <Wincrypt.h>
// HACK Fix exports
namespace SQLite
{
// Return the result code (if any, otherwise -1).
int Exception::getErrorCode() const noexcept // nothrow
{
return mErrcode;
}
// Return the extended numeric result code (if any, otherwise -1).
int Exception::getExtendedErrorCode() const noexcept // nothrow
{
return mExtendedErrcode;
}
// Return a string, solely based on the error code
const char* Exception::getErrorStr() const noexcept // nothrow
{
return sqlite3_errstr(mErrcode);
}
}
#endif
NS_BEGIN(Sia)

View File

@@ -1,9 +1,10 @@
#include <uploadmanager.h>
#include <SQLiteCpp/Exception.h>
#include <uploadmanager.h>
#include <siaapi.h>
#include <eventsystem.h>
#include <siadriveconfig.h>
#include <sqlite3.h>
using namespace Sia::Api;
#define TABLE_CREATE L"create table if not exists %s (%s);"
@@ -169,7 +170,8 @@ void CUploadManager::UpdateFileQueueOnStartup()
}
catch (SQLite::Exception e)
{
throw StartupException(SString(e.getErrorStr()));
SString msg = e.getErrorStr();
throw StartupException(msg);
}
}