aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-09 09:31:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-09 09:31:53 +0200
commitd3a1c61c2c10d952c7a186d367b42a1ea1b3e946 (patch)
treee41a4f37d10715843aee1a0ac724960ab0b5ebe8
parentab48e8593260239b432f2e03c9b69a2e83211a77 (diff)
Rework MySQL header inclusion
-rw-r--r--odb/mysql/connection-factory.cxx15
-rw-r--r--odb/mysql/connection.hxx13
-rw-r--r--odb/mysql/database.hxx13
-rw-r--r--odb/mysql/exceptions.cxx13
-rw-r--r--odb/mysql/exceptions.hxx13
-rw-r--r--odb/mysql/mysql-types.hxx19
-rw-r--r--odb/mysql/mysql.hxx15
-rw-r--r--odb/mysql/query.hxx13
-rw-r--r--odb/mysql/statement.cxx13
-rw-r--r--odb/mysql/statement.hxx13
-rw-r--r--odb/mysql/traits.hxx13
-rw-r--r--odb/mysql/transaction-impl.cxx13
12 files changed, 39 insertions, 127 deletions
diff --git a/odb/mysql/connection-factory.cxx b/odb/mysql/connection-factory.cxx
index 2bfd566..41ff2fd 100644
--- a/odb/mysql/connection-factory.cxx
+++ b/odb/mysql/connection-factory.cxx
@@ -3,20 +3,7 @@
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-# include <errmsg.h> // CR_UNKNOWN_ERROR
-#else
-# include <mysql/mysql.h>
-# include <mysql/errmsg.h>
-#endif
-
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/connection-factory.hxx>
#include <odb/mysql/exceptions.hxx>
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx
index b00be75..7bbc335 100644
--- a/odb/mysql/connection.hxx
+++ b/odb/mysql/connection.hxx
@@ -8,22 +8,11 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <vector>
#include <odb/forward.hxx>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
#include <odb/mysql/statement.hxx>
diff --git a/odb/mysql/database.hxx b/odb/mysql/database.hxx
index b10b037..9f07f03 100644
--- a/odb/mysql/database.hxx
+++ b/odb/mysql/database.hxx
@@ -8,23 +8,12 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <string>
#include <memory> // std::auto_ptr
#include <odb/database.hxx>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx>
#include <odb/mysql/connection.hxx>
diff --git a/odb/mysql/exceptions.cxx b/odb/mysql/exceptions.cxx
index 636c223..1c535dd 100644
--- a/odb/mysql/exceptions.cxx
+++ b/odb/mysql/exceptions.cxx
@@ -3,21 +3,10 @@
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <errmsg.h> // CR_OUT_OF_MEMORY
-#else
-# include <mysql/errmsg.h>
-#endif
-
#include <new> // std::bad_alloc
#include <sstream>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/exceptions.hxx>
using namespace std;
diff --git a/odb/mysql/exceptions.hxx b/odb/mysql/exceptions.hxx
index 834a4d6..f9d3730 100644
--- a/odb/mysql/exceptions.hxx
+++ b/odb/mysql/exceptions.hxx
@@ -8,22 +8,11 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <string>
#include <odb/exceptions.hxx>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
#include <odb/mysql/details/export.hxx>
diff --git a/odb/mysql/mysql-types.hxx b/odb/mysql/mysql-types.hxx
new file mode 100644
index 0000000..620904f
--- /dev/null
+++ b/odb/mysql/mysql-types.hxx
@@ -0,0 +1,19 @@
+// file : odb/mysql/mysql-types.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_MYSQL_MYSQL_TYPES_HXX
+#define ODB_MYSQL_MYSQL_TYPES_HXX
+
+#include <odb/mysql/details/config.hxx>
+
+typedef char my_bool;
+
+#ifdef LIBODB_MYSQL_INCLUDE_SHORT
+# include <mysql_time.h>
+#else
+# include <mysql/mysql_time.h>
+#endif
+
+#endif // ODB_MYSQL_MYSQL_TYPES_HXX
diff --git a/odb/mysql/mysql.hxx b/odb/mysql/mysql.hxx
index 2988870..962eb5a 100644
--- a/odb/mysql/mysql.hxx
+++ b/odb/mysql/mysql.hxx
@@ -1,22 +1,27 @@
-/* file : odb/mysql/mysql.hxx
- * author : Boris Kolpackov <boris@codesynthesis.com>
- * copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
- * license : GNU GPL v2; see accompanying LICENSE file
- */
+// file : odb/mysql/mysql.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_MYSQL_MYSQL_HXX
#define ODB_MYSQL_MYSQL_HXX
#include <odb/mysql/details/config.hxx>
+#include <odb/mysql/mysql-types.hxx>
+
#ifdef _WIN32
# include <winsock2.h>
#endif
#ifdef LIBODB_MYSQL_INCLUDE_SHORT
# include <mysql.h>
+# include <errmsg.h>
+# include <mysqld_error.h>
#else
# include <mysql/mysql.h>
+# include <mysql/errmsg.h>
+# include <mysql/mysqld_error.h>
#endif
#endif // ODB_MYSQL_MYSQL_HXX
diff --git a/odb/mysql/query.hxx b/odb/mysql/query.hxx
index 7d2d2d4..4e0320f 100644
--- a/odb/mysql/query.hxx
+++ b/odb/mysql/query.hxx
@@ -8,24 +8,13 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <string>
#include <vector>
#include <cstddef> // std::size_t
#include <odb/query.hxx>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx>
#include <odb/mysql/traits.hxx>
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index 95edbbd..0cab7cc 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -3,18 +3,7 @@
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysqld_error.h> // ER_DUP_ENTRY, ER_LOCK_DEADLOCK
-#else
-# include <mysql/mysqld_error.h>
-#endif
-
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/statement.hxx>
#include <odb/mysql/connection.hxx>
#include <odb/mysql/exceptions.hxx>
diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx
index 78681a2..05deb4d 100644
--- a/odb/mysql/statement.hxx
+++ b/odb/mysql/statement.hxx
@@ -8,18 +8,6 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <map>
#include <string>
#include <cstddef> // std::size_t
@@ -28,6 +16,7 @@
#include <odb/forward.hxx>
#include <odb/traits.hxx>
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
#include <odb/details/shared-ptr.hxx>
diff --git a/odb/mysql/traits.hxx b/odb/mysql/traits.hxx
index a520d1b..f05e04e 100644
--- a/odb/mysql/traits.hxx
+++ b/odb/mysql/traits.hxx
@@ -8,24 +8,13 @@
#include <odb/pre.hxx>
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h> // MYSQL_TIME, used in custom specializations.
-#else
-# include <mysql/mysql.h>
-#endif
-
#include <string>
#include <cstddef> // std::size_t
#include <odb/traits.hxx>
#include <odb/mysql/version.hxx>
+#include <odb/mysql/mysql-types.hxx>
#include <odb/details/buffer.hxx>
diff --git a/odb/mysql/transaction-impl.cxx b/odb/mysql/transaction-impl.cxx
index 04493e6..df41015 100644
--- a/odb/mysql/transaction-impl.cxx
+++ b/odb/mysql/transaction-impl.cxx
@@ -3,18 +3,7 @@
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#include <odb/mysql/details/config.hxx>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#endif
-
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql.h>
-#else
-# include <mysql/mysql.h>
-#endif
-
+#include <odb/mysql/mysql.hxx>
#include <odb/mysql/database.hxx>
#include <odb/mysql/connection.hxx>
#include <odb/mysql/exceptions.hxx>