# HG changeset patch # User Sebastien Jodogne # Date 1526462789 -7200 # Node ID 23548462c77d0fc4d37a70c4ce70b3b58ec081da # Parent 441f23af9d898fb41d0ddc52e919124ef31dd546# Parent 1f7b459b247bea25cd3feab228e3fc0077eaf770 integration mainline->jobs diff -r 441f23af9d89 -r 23548462c77d Core/SQLite/Statement.cpp --- a/Core/SQLite/Statement.cpp Wed May 16 11:26:08 2018 +0200 +++ b/Core/SQLite/Statement.cpp Wed May 16 11:26:29 2018 +0200 @@ -46,8 +46,21 @@ #include #include -#if ORTHANC_SQLITE_STANDALONE != 1 -#include "../Logging.h" +#if (ORTHANC_SQLITE_STANDALONE == 1) +// Trace logging is disabled if this SQLite wrapper is used +// independently of Orthanc +# define LOG_CREATE(message); +# define LOG_APPLY(message); +#elif defined(NDEBUG) +// Trace logging is disabled in release builds +# include "../Logging.h" +# define LOG_CREATE(message); +# define LOG_APPLY(message); +#else +// Trace logging is enabled in debug builds +# include "../Logging.h" +# define LOG_CREATE(message) VLOG(1) << "SQLite::Statement create: " << message; +# define LOG_APPLY(message); // VLOG(1) << "SQLite::Statement apply: " << message; #endif #include "sqlite3.h" @@ -56,6 +69,7 @@ #define snprintf _snprintf #endif + namespace Orthanc { namespace SQLite @@ -103,6 +117,7 @@ reference_(database.GetCachedStatement(id, sql.c_str())) { Reset(true); + LOG_CREATE(sql); } @@ -112,6 +127,7 @@ reference_(database.GetCachedStatement(id, sql)) { Reset(true); + LOG_CREATE(sql); } @@ -119,6 +135,7 @@ const std::string& sql) : reference_(database.GetWrappedObject(), sql.c_str()) { + LOG_CREATE(sql); } @@ -126,23 +143,20 @@ const char* sql) : reference_(database.GetWrappedObject(), sql) { + LOG_CREATE(sql); } bool Statement::Run() { -#if ORTHANC_SQLITE_STANDALONE != 1 - VLOG(1) << "SQLite::Statement::Run " << sqlite3_sql(GetStatement()); -#endif + LOG_APPLY(sqlite3_sql(GetStatement())); return CheckError(sqlite3_step(GetStatement()), ErrorCode_SQLiteCannotRun) == SQLITE_DONE; } bool Statement::Step() { -#if ORTHANC_SQLITE_STANDALONE != 1 - VLOG(1) << "SQLite::Statement::Step " << sqlite3_sql(GetStatement()); -#endif + LOG_APPLY(sqlite3_sql(GetStatement())); return CheckError(sqlite3_step(GetStatement()), ErrorCode_SQLiteCannotStep) == SQLITE_ROW; } diff -r 441f23af9d89 -r 23548462c77d Resources/Samples/Lua/WriteToDisk.lua --- a/Resources/Samples/Lua/WriteToDisk.lua Wed May 16 11:26:08 2018 +0200 +++ b/Resources/Samples/Lua/WriteToDisk.lua Wed May 16 11:26:29 2018 +0200 @@ -2,7 +2,8 @@ function ToAscii(s) -- http://www.lua.org/manual/5.1/manual.html#pdf-string.gsub - return s:gsub('[^a-zA-Z0-9-/ ]', '_') + -- https://groups.google.com/d/msg/orthanc-users/qMLgkEmwwPI/6jRpCrlgBwAJ + return s:gsub('[^a-zA-Z0-9-/-: ]', '_') end function OnStableSeries(seriesId, tags, metadata)