[glom] libglom: Added DbUtils::set_fake_connection().



commit 3cc85313bb90fe8d59900f1868bc63afdeda0d8f
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 21 13:25:43 2011 +0100

    libglom: Added DbUtils::set_fake_connection().
    
    * glom/libglom/db_utils.[h|cc]: Added DbUtils::set_fake_connection()
      because ConnectionPool is not public API.
    * tests/test_fake_connection.cc: Use this function instead of using
    ConnectionPool's API.

 ChangeLog                     |    9 +++++++++
 glom/libglom/db_utils.cc      |   10 ++++++++++
 glom/libglom/db_utils.h       |    4 ++++
 tests/test_fake_connection.cc |    8 +-------
 4 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 00bd86c..ab71db6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-21  Murray Cumming  <murrayc murrayc com>
+
+	libglom: Added DbUtils::set_fake_connection().
+
+	* glom/libglom/db_utils.[h|cc]: Added DbUtils::set_fake_connection()
+  because ConnectionPool is not public API.
+	* tests/test_fake_connection.cc: Use this function instead of using 
+	ConnectionPool's API.
+
 1.20.0 (stable):
 
 2011-11-20  Murray Cumming  <murrayc murrayc com>
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 704f768..4f42caa 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1912,6 +1912,16 @@ Glib::ustring build_query_add_user_to_group(const Glib::ustring& group, const Gl
   return "ALTER GROUP " + escape_sql_id(group) + " ADD USER " + escape_sql_id(user);
 }
 
+void set_fake_connection()
+{
+  //Allow a fake connection, so sqlbuilder_get_full_query() can work:
+  Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
+  Glom::ConnectionPoolBackends::Backend* backend = 
+    new Glom::ConnectionPoolBackends::PostgresCentralHosted();
+  connection_pool->set_backend(std::auto_ptr<Glom::ConnectionPool::Backend>(backend));
+  connection_pool->set_fake_connection();
+}
+
 } //namespace DbUtils
 
 } //namespace Glom
diff --git a/glom/libglom/db_utils.h b/glom/libglom/db_utils.h
index a50df37..fa97683 100644
--- a/glom/libglom/db_utils.h
+++ b/glom/libglom/db_utils.h
@@ -160,6 +160,10 @@ Glib::ustring build_query_create_group(const Glib::ustring& group, bool superuse
 
 Glib::ustring build_query_add_user_to_group(const Glib::ustring& group, const Glib::ustring& user);
 
+/** Allow a fake connection, so sqlbuilder_get_full_query() can work.
+ */
+void set_fake_connection();
+
 } //namespace DbUtils
 
 } //namespace Glom
diff --git a/tests/test_fake_connection.cc b/tests/test_fake_connection.cc
index 9b55b79..3764694 100644
--- a/tests/test_fake_connection.cc
+++ b/tests/test_fake_connection.cc
@@ -22,8 +22,6 @@
 #include <libglom/init.h>
 #include <libglom/utils.h>
 #include <libglom/db_utils.h>
-#include <libglom/connectionpool.h>
-#include <libglom/connectionpool_backends/postgres_central.h>
 #include <giomm/file.h>
 #include <glibmm/convert.h>
 #include <glibmm/miscutils.h>
@@ -64,11 +62,7 @@ int main()
   }
 
   //Allow a fake connection, so sqlbuilder_get_full_query() can work:
-  Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
-  Glom::ConnectionPoolBackends::Backend* backend = 
-    new Glom::ConnectionPoolBackends::PostgresCentralHosted();
-  connection_pool->set_backend(std::auto_ptr<Glom::ConnectionPool::Backend>(backend));
-  connection_pool->set_fake_connection();
+  Glom::DbUtils::set_fake_connection();
 
   //Build a SQL query and get the string for it:
   const Gnome::Gda::Value value("Born To Run");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]