changeset 2592:23548462c77d jobs

integration mainline->jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 May 2018 11:26:29 +0200
parents 441f23af9d89 (current diff) 1f7b459b247b (diff)
children 7b72061157b1
files
diffstat 2 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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 <stdio.h>
 #include <algorithm>
 
-#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;
     }
--- 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)