Description: Fix inclusion of PostgreSQL
Author: Sebastien Jodogne <s.jodogne@gmail.com>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLDatabase.cpp
===================================================================
--- OrthancPostgreSQL-3.0.orig/Framework/PostgreSQL/PostgreSQLDatabase.cpp
+++ OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLDatabase.cpp
@@ -19,6 +19,7 @@
  **/
 
 
+#include "PostgreSQLIncludes.h"  // Must be the first
 #include "PostgreSQLDatabase.h"
 
 #include "PostgreSQLResult.h"
@@ -26,23 +27,11 @@
 #include "PostgreSQLTransaction.h"
 #include "../Common/ImplicitTransaction.h"
 
-#include <pg_config.h>
-
-#if PG_VERSION_NUM >= 110000
-#  include <postgres.h>
-#  undef LOG  // This one comes from <postgres.h>, and conflicts with <Core/Logging.h>
-#endif
-
 #include <Core/Logging.h>
 #include <Core/OrthancException.h>
 
 #include <boost/lexical_cast.hpp>
 
-// PostgreSQL includes
-#include <libpq-fe.h>
-#include <c.h>
-#include <catalog/pg_type.h>
-
 
 namespace OrthancDatabases
 {
Index: OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLIncludes.h
===================================================================
--- /dev/null
+++ OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLIncludes.h
@@ -0,0 +1,34 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2019 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+// PostgreSQL includes
+#include <pg_config.h>
+
+#if PG_VERSION_NUM >= 110000
+#  include <postgres.h>
+#  undef LOG  // This one comes from <postgres.h>, and conflicts with <Core/Logging.h>
+#endif
+
+#include <libpq-fe.h>
+#include <c.h>
+#include <catalog/pg_type.h>
Index: OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLLargeObject.cpp
===================================================================
--- OrthancPostgreSQL-3.0.orig/Framework/PostgreSQL/PostgreSQLLargeObject.cpp
+++ OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLLargeObject.cpp
@@ -21,6 +21,7 @@
 
 // http://www.postgresql.org/docs/9.1/static/lo-interfaces.html#AEN33102
 
+#include "PostgreSQLIncludes.h"  // Must be the first
 #include "PostgreSQLLargeObject.h"
 
 #include <Core/Logging.h>
Index: OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLResult.cpp
===================================================================
--- OrthancPostgreSQL-3.0.orig/Framework/PostgreSQL/PostgreSQLResult.cpp
+++ OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLResult.cpp
@@ -19,6 +19,7 @@
  **/
 
 
+#include "PostgreSQLIncludes.h"  // Must be the first
 #include "PostgreSQLResult.h"
 
 #include "../Common/BinaryStringValue.h"
@@ -27,26 +28,13 @@
 #include "../Common/NullValue.h"
 #include "../Common/Utf8StringValue.h"
 
-#include <pg_config.h>
-
-#if PG_VERSION_NUM >= 110000
-#  include <postgres.h>
-#  undef LOG  // This one comes from <postgres.h>, and conflicts with <Core/Logging.h>
-#endif
-
 #include <Core/OrthancException.h>
 #include <Core/Logging.h>
+#include <Core/Endianness.h>
 
 #include <cassert>
 #include <boost/lexical_cast.hpp>
 
-// PostgreSQL includes
-#include <libpq-fe.h>
-#include <c.h>
-#include <catalog/pg_type.h>
-
-#include <Core/Endianness.h>
-
 
 namespace OrthancDatabases
 {
Index: OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLStatement.cpp
===================================================================
--- OrthancPostgreSQL-3.0.orig/Framework/PostgreSQL/PostgreSQLStatement.cpp
+++ OrthancPostgreSQL-3.0/Framework/PostgreSQL/PostgreSQLStatement.cpp
@@ -19,6 +19,7 @@
  **/
 
 
+#include "PostgreSQLIncludes.h"  // Must be the first
 #include "PostgreSQLStatement.h"
 
 #include "../Common/BinaryStringValue.h"
@@ -29,26 +30,13 @@
 #include "../Common/Utf8StringValue.h"
 #include "PostgreSQLResult.h"
 
-#include <pg_config.h>
-
-#if PG_VERSION_NUM >= 110000
-#  include <postgres.h>
-#  undef LOG  // This one comes from <postgres.h>, and conflicts with <Core/Logging.h>
-#endif
-
 #include <Core/Logging.h>
 #include <Core/OrthancException.h>
 #include <Core/Toolbox.h>
+#include <Core/Endianness.h>
 
 #include <cassert>
 
-// PostgreSQL includes
-#include <libpq-fe.h>
-#include <c.h>
-#include <catalog/pg_type.h>
-
-#include <Core/Endianness.h>
-
 
 namespace OrthancDatabases
 {
