changeset 29:2fb9cd42af14

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Jul 2018 15:20:35 +0200
parents c0cb5d2cd696
children e7732cf515df
files Framework/Common/DatabaseManager.cpp Framework/Common/DatabaseManager.h Framework/Common/FileValue.h Framework/Common/GenericFormatter.h Framework/Common/Query.h Framework/PostgreSQL/PostgreSQLDatabase.cpp PostgreSQL/NEWS
diffstat 7 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/DatabaseManager.cpp	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/Common/DatabaseManager.cpp	Mon Jul 16 15:20:35 2018 +0200
@@ -364,8 +364,8 @@
   DatabaseManager::CachedStatement::CachedStatement(const StatementLocation& location,
                                                     Transaction& transaction,
                                                     const char* sql) :
+    manager_(transaction.GetManager()),
     lock_(manager_.mutex_),
-    manager_(transaction.GetManager()),
     database_(manager_.GetDatabase()),
     location_(location),
     transaction_(manager_.GetTransaction())
--- a/Framework/Common/DatabaseManager.h	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/Common/DatabaseManager.h	Mon Jul 16 15:20:35 2018 +0200
@@ -57,7 +57,7 @@
     void ReleaseImplicitTransaction();
 
   public:
-    DatabaseManager(IDatabaseFactory* factory);  // Takes ownership
+    explicit DatabaseManager(IDatabaseFactory* factory);  // Takes ownership
     
     ~DatabaseManager()
     {
@@ -93,7 +93,7 @@
       bool                                 committed_;
 
     public:
-      Transaction(DatabaseManager& manager);
+      explicit Transaction(DatabaseManager& manager);
 
       ~Transaction();
 
@@ -114,8 +114,8 @@
     class CachedStatement : public boost::noncopyable
     {
     private:
+      DatabaseManager&                     manager_;
       boost::recursive_mutex::scoped_lock  lock_;
-      DatabaseManager&                     manager_;
       IDatabase&                           database_;
       StatementLocation                    location_;
       ITransaction&                        transaction_;
--- a/Framework/Common/FileValue.h	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/Common/FileValue.h	Mon Jul 16 15:20:35 2018 +0200
@@ -35,7 +35,7 @@
     {
     }
 
-    FileValue(const std::string& content) :
+    explicit FileValue(const std::string& content) :
       content_(content)
     {
     }
--- a/Framework/Common/GenericFormatter.h	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/Common/GenericFormatter.h	Mon Jul 16 15:20:35 2018 +0200
@@ -33,7 +33,7 @@
     std::vector<ValueType>    parametersType_;
       
   public:
-    GenericFormatter(Dialect dialect) :
+    explicit GenericFormatter(Dialect dialect) :
       dialect_(dialect)
     {
     }
--- a/Framework/Common/Query.h	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/Common/Query.h	Mon Jul 16 15:20:35 2018 +0200
@@ -58,7 +58,7 @@
     void Setup(const std::string& sql);
 
   public:
-    Query(const std::string& sql);
+    explicit Query(const std::string& sql);
 
     Query(const std::string& sql,
           bool isReadOnly);
--- a/Framework/PostgreSQL/PostgreSQLDatabase.cpp	Mon Jul 16 14:48:43 2018 +0200
+++ b/Framework/PostgreSQL/PostgreSQLDatabase.cpp	Mon Jul 16 15:20:35 2018 +0200
@@ -104,8 +104,9 @@
   {
     PostgreSQLTransaction transaction(*this);
 
-    PostgreSQLStatement s(*this, "select pg_try_advisory_lock(" + 
-                          boost::lexical_cast<std::string>(lock) + ");");
+    Query query("select pg_try_advisory_lock(" + 
+                boost::lexical_cast<std::string>(lock) + ");", false);
+    PostgreSQLStatement s(*this, query);
 
     PostgreSQLResult result(s);
     if (result.IsDone() ||
--- a/PostgreSQL/NEWS	Mon Jul 16 14:48:43 2018 +0200
+++ b/PostgreSQL/NEWS	Mon Jul 16 15:20:35 2018 +0200
@@ -1,12 +1,13 @@
 Pending changes in the mainline
 ===============================
 
-Important remark when upgrading from an older version of the Plugin:
-* The plugin will create a new index to improve search performances.
-  This can take several minutes at Orthanc startup.  Orthanc will not
-  be available during this period.
-  On a 100000 studies DB, we've observed that the creation of this index 
-  took around 10 minutes.
+!! Important remark when upgrading from an older version of the plugin:
+
+   The plugin will create a new index to improve search performance.
+   This can take several minutes at the first Orthanc startup. Orthanc
+   will not be available during this period. On a PostgreSQL database
+   with 100,000 studies, we have observed that updating the index took
+   around 10 minutes.
 
 * Migration into the "orthanc-databases" repository
 * Full refactoring to share code with MySQL