[glom/sqlbuilder2] Remove redundant BaseDb::query_execute*() methods.



commit ba9cf17b05a438928d7243bb59ac97c6090c0c0e
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed May 12 23:51:25 2010 +0200

    Remove redundant BaseDb::query_execute*() methods.
    
    * glom/base_db.[h|cc]: Removed query_execute_select() and query_execute().
    The same methods in DbUtils replace them.
    * glom/libglom/db_utils.h: Removed the query_execute_select(string) override.
    * glom/mode_data/box_data_calendar_related.cc:
    * glom/mode_data/box_data_details.cc:
    * glom/mode_data/box_data_portal.cc:
    * glom/mode_design/dialog_database_preferences.cc:
    * glom/mode_design/fields/box_db_table_definition.cc:
    * glom/mode_design/users/dialog_groups_list.cc:
    * glom/mode_design/users/dialog_users_list.cc:
    * glom/navigation/box_tables.cc:
    * glom/print_layout/canvas_print_layout.cc:
    * glom/report_builder.cc:
    * glom/base_db_table_data.cc:
    * glom/frame_glom.cc:
    * glom/libglom/db_utils.cc: Adapted.

 ChangeLog                                          |   21 ++
 glom/base_db.cc                                    |  338 ++------------------
 glom/base_db.h                                     |   19 --
 glom/base_db_table_data.cc                         |   12 +-
 glom/frame_glom.cc                                 |    6 +-
 glom/libglom/db_utils.cc                           |   92 ------
 glom/libglom/db_utils.h                            |    5 -
 glom/mode_data/box_data_calendar_related.cc        |    5 +-
 glom/mode_data/box_data_details.cc                 |    2 +-
 glom/mode_data/box_data_portal.cc                  |    5 +-
 glom/mode_design/dialog_database_preferences.cc    |    4 +-
 glom/mode_design/fields/box_db_table_definition.cc |    6 +-
 glom/mode_design/users/dialog_groups_list.cc       |    6 +-
 glom/mode_design/users/dialog_users_list.cc        |    7 +-
 glom/navigation/box_tables.cc                      |    4 +-
 glom/print_layout/canvas_print_layout.cc           |    5 +-
 glom/report_builder.cc                             |    7 +-
 17 files changed, 77 insertions(+), 467 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 15ddc1f..448dd62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2010-05-12  Murray Cumming  <murrayc murrayc com>
+
+	Remove redundant BaseDb::query_execute*() methods.
+
+	* glom/base_db.[h|cc]: Removed query_execute_select() and query_execute(). 
+	The same methods in DbUtils replace them.
+	* glom/libglom/db_utils.h: Removed the query_execute_select(string) override.
+	* glom/mode_data/box_data_calendar_related.cc:
+	* glom/mode_data/box_data_details.cc:
+	* glom/mode_data/box_data_portal.cc:
+	* glom/mode_design/dialog_database_preferences.cc:
+	* glom/mode_design/fields/box_db_table_definition.cc:
+	* glom/mode_design/users/dialog_groups_list.cc:
+	* glom/mode_design/users/dialog_users_list.cc:
+	* glom/navigation/box_tables.cc:
+	* glom/print_layout/canvas_print_layout.cc:
+	* glom/report_builder.cc:
+	* glom/base_db_table_data.cc:
+	* glom/frame_glom.cc:
+	* glom/libglom/db_utils.cc: Adapted.
+
 2010-05-11  Daniel Borgmann  <danielb openismus com>
 
 	Don't add a new row when cancelling a placeholder edit.
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 6deaf1b..875b5a4 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -162,306 +162,6 @@ bool Base_DB::handle_error()
   return ConnectionPool::handle_error_cerr_only();
 }
 
-//static:
-Glib::RefPtr<Gnome::Gda::DataModel> Base_DB::query_execute_select(const Glib::ustring& strQuery,
-                                                                  const Glib::RefPtr<Gnome::Gda::Set>& params)
-{
-  Glib::RefPtr<Gnome::Gda::DataModel> result;
-
-  //TODO: BusyCursor busy_cursor(get_app_window());
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  sharedptr<SharedConnection> sharedconnection = connect_to_server();
-#else
-  std::auto_ptr<ExceptionConnection> error;
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
-  if(error.get())
-  {
-    g_warning("Base_DB::query_execute_select() failed (query was: %s): %s", strQuery.c_str(), error->what());
-    // TODO: Rethrow?
-  }
-#endif
-  if(!sharedconnection)
-  {
-    std::cerr << "Base_DB::query_execute_select(): No connection yet." << std::endl;
-    return result;
-  }
-
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
-  Glib::RefPtr<Gnome::Gda::SqlParser> parser = gda_connection->create_parser();
-
-  Glib::RefPtr<Gnome::Gda::Statement> stmt;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    stmt = parser->parse_string(strQuery);
-  }
-  catch(const Gnome::Gda::SqlParserError& ex)
-  {
-    std::cout << "debug: Base_DB::query_execute_select(): SqlParserError: exception from parse_string(): " << ex.what() << std::endl;
-  }
-#else
-  std::auto_ptr<Glib::Error> ex;
-  stmt = parser->parse_string(strQuery, ex);
-  if(error.get())
-     std::cout << "debug: Base_DB::query_execute_select(): SqlParserError: exception from parse_string(): " << error->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-
-  //Debug output:
-  const Application* app = Application::get_application();
-  if(stmt && app && app->get_show_sql_debug())
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(gda_connection, strQuery, params);
-    std::cout << "Debug: Base_DB::query_execute_select():  " << full_query << std::endl;
-  }
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    result = gda_connection->statement_execute_select(stmt, params);
-  }
-  catch(const Gnome::Gda::ConnectionError& ex)
-  {
-    std::cout << "debug: Base_DB::query_execute_select(): ConnectionError: exception from statement_execute_select(): " << ex.what() << std::endl;
-  }
-  catch(const Gnome::Gda::ServerProviderError& ex)
-  {
-    std::cout << "debug: Base_DB::query_execute_select(): ServerProviderError exception from statement_execute_select(): code=" << ex.code() << ", message=" << ex.what() << std::endl;
-  }
-  catch(const Glib::Error& ex)
-  {
-    std::cout << "debug: Base_DB::query_execute_select(): Error exception from statement_execute_select(): " << ex.what() << std::endl;
-  }
-#else
-  result = gda_connection->statement_execute_select(stmt, params, ex);
-  if(ex.get())
-    std::cout << "debug: Base_DB::query_execute_select(): Glib::Error from statement_execute_select(): " << ex->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  if(!result)
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(gda_connection, strQuery, params);
-    std::cerr << "Glom  Base_DB::query_execute_select(): Error while executing SQL" << std::endl <<
-      "  " <<  full_query << std::endl;
-    handle_error();
-  }
-
-  return result;
-}
-
-//static:
-Glib::RefPtr<Gnome::Gda::DataModel> Base_DB::query_execute_select(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
-                                                                  const Glib::RefPtr<const Gnome::Gda::Set>& params)
-{
-  Glib::RefPtr<Gnome::Gda::DataModel> result;
-
-  //TODO: BusyCursor busy_cursor(get_app_window());
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  sharedptr<SharedConnection> sharedconnection = connect_to_server();
-#else
-  std::auto_ptr<ExceptionConnection> error;
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
-  if(error.get())
-  {
-    g_warning("Base_DB::query_execute_select() failed (query was: %s): %s", strQuery.c_str(), error->what());
-    // TODO: Rethrow?
-  }
-#endif
-  if(!sharedconnection)
-  {
-    std::cerr << "Base_DB::query_execute_select(): No connection yet." << std::endl;
-    return result;
-  }
-
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
-
-  //Debug output:
-  const Application* app = Application::get_application();
-  if(app && app->get_show_sql_debug())
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(builder, params);
-    std::cout << "Debug: Base_DB::query_execute_select():  " << full_query << std::endl;
-  }
-
-  //TODO: Use DbUtils::query_execute().
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    result = gda_connection->statement_execute_select_builder(builder, params);
-  }
-  catch(const Gnome::Gda::ConnectionError& ex)
-  {
-    std::cerr << "debug: Base_DB::query_execute_select(): ConnectionError: exception from statement_execute_select_builder(): " << ex.what() << std::endl;
-  }
-  catch(const Gnome::Gda::ServerProviderError& ex)
-  {
-    std::cerr << "debug: Base_DB::query_execute_select(): ServerProviderError: exception from statement_execute_select_builder(): code=" << ex.code() << "message=" << ex.what() << std::endl;
-  }
-  catch(const Glib::Error& ex)
-  {
-    std::cerr << "debug: Base_DB::query_execute_select(): Error: exception from statement_execute_select_builder(): " << ex.what() << std::endl;
-  }
-
-#else
-  result = gda_connection->statement_execute_select_builder(builder, params, ex);
-  if(ex.get())
-    std::cerr << "debug: Base_DB::query_execute_select(): Glib::Error from statement_execute_select_builder(): " << ex->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  if(!result)
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(builder, params);
-    std::cerr << "Glom  Base_DB::query_execute_select(): Error while executing SQL: "
-      << std::endl << "  " << full_query << std::endl << std::endl;
-    handle_error();
-  }
-
-  return result;
-}
-
-//static:
-bool Base_DB::query_execute(const Glib::ustring& strQuery,
-                            const Glib::RefPtr<Gnome::Gda::Set>& params)
-{
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  sharedptr<SharedConnection> sharedconnection = connect_to_server();
-#else
-  std::auto_ptr<ExceptionConnection> error;
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
-  if(error.get())
-  {
-    g_warning("Base_DB::query_execute() failed (query was: %s): %s", strQuery.c_str(), error->what());
-    // TODO: Rethrow?
-  }
-#endif
-  if(!sharedconnection)
-  {
-    std::cerr << "Base_DB::query_execute(): No connection yet." << std::endl;
-    return false;
-  }
-
-  //TODO: Use DbUtils::query_execute().
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
-  Glib::RefPtr<Gnome::Gda::SqlParser> parser = gda_connection->create_parser();
-  Glib::RefPtr<Gnome::Gda::Statement> stmt;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    stmt = parser->parse_string(strQuery);
-  }
-  catch(const Gnome::Gda::SqlParserError& error)
-  {
-    std::cerr << "DEBUG: BaseDB::query_execute: SqlParserError: " << error.what() << std::endl;
-    return false;
-  }
-#else
-  std::auto_ptr<Glib::Error> sql_error;
-  stmt = parser->parse_string(strQuery, sql_error);
-  if(sql_error.get())
-  {
-    std::cerr << "DEBUG: BaseDB::query_execute: SqlParserError:" << sql_error->what() << std::endl;
-    return false;
-  }
-#endif
-
-
-  //Debug output:
-  const Application* app = Application::get_application();
-  if(stmt && app && app->get_show_sql_debug())
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(gda_connection, strQuery, params);
-    std::cerr << "Debug: Base_DB::query_execute(): " << full_query << std::endl;
-  }
-
-
-  int exec_retval = -1;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    exec_retval = gda_connection->statement_execute_non_select(stmt, params);
-  }
-  catch(const Glib::Error& error)
-  {
-    std::cerr << "BaseDB::query_execute: ConnectionError: " << error.what() << std::endl;
-    const std::string full_query = Utils::sqlbuilder_get_full_query(gda_connection, strQuery, params);
-    std::cerr << "  full_query: " << full_query << std::endl;
-    return false;
-  }
-#else
-  std::auto_ptr<Glib::Error> exec_error;
-  exec_retval = gda_connection->statement_execute_non_select (stmt, params, exec_error);
-  if(exec_error.get())
-  {
-    std::cerr << "BaseDB::query_execute: ConnectionError: " << exec_error->what() << std::endl;
-    const std::string full_query = Utils::sqlbuilder_get_full_query(gda_connection, stmt, params);
-    std::cerr << "  full_query: " << full_query << std::endl;
-    return false;
-  }
-#endif
-  return (exec_retval >= 0);
-}
-
-//static:
-bool Base_DB::query_execute(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
-                            const Glib::RefPtr<const Gnome::Gda::Set>& params)
-{
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  sharedptr<SharedConnection> sharedconnection = connect_to_server();
-#else
-  std::auto_ptr<ExceptionConnection> error;
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
-  if(error.get())
-  {
-    g_warning("Base_DB::query_execute() failed (query was: %s): %s", strQuery.c_str(), error->what());
-    // TODO: Rethrow?
-  }
-#endif
-  if(!sharedconnection)
-  {
-    std::cerr << "Base_DB::query_execute(): No connection yet." << std::endl;
-    return false;
-  }
-
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
-
-  //Debug output:
-  const Application* app = Application::get_application();
-  if(app && app->get_show_sql_debug())
-  {
-    const std::string full_query = Utils::sqlbuilder_get_full_query(builder, params);
-    std::cerr << "Debug: Base_DB::query_execute(): " << full_query << std::endl;
-  }
-
-
-  int exec_retval = -1;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    exec_retval = gda_connection->statement_execute_non_select_builder(builder, params);
-  }
-  catch(const Glib::Error& error)
-  {
-    std::cerr << "BaseDB::query_execute: ConnectionError: " << error.what() << std::endl;
-    const std::string full_query = Utils::sqlbuilder_get_full_query(builder, params);
-    std::cerr << "  full_query: " << full_query << std::endl;
-    return false;
-  }
-#else
-  std::auto_ptr<Glib::Error> exec_error;
-  exec_retval = gda_connection->statement_execute_non_select_builder(builder, params, exec_error);
-  if(exec_error.get())
-  {
-    std::cerr << "BaseDB::query_execute: ConnectionError: " << exec_error->what() << std::endl;
-    const std::string full_query = Utils::sqlbuilder_get_full_query(builder, params);
-    std::cerr << "  full_query: " << full_query << std::endl;
-    return false;
-  }
-#endif
-  return (exec_retval >= 0);
-}
-
 void Base_DB::load_from_document()
 {
   if(get_document())
@@ -1217,7 +917,7 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
   builder->select_add_field(primary_key->get_name(), table_name);
   builder->select_add_target(table_name);
 
-  Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute_select(builder);
+  Glib::RefPtr<Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(builder);
   if(!data_model || !data_model->get_n_rows() || !data_model->get_n_columns())
   {
     //HandleError();
@@ -1423,7 +1123,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
       try
       {
-        data_model = query_execute_select(query);
+        data_model = DbUtils::query_execute_select(query);
       }
       catch(const Glib::Exception& ex)
       {
@@ -1432,9 +1132,9 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
         return field_values;
       }
 #else
-      //TODO: Seems there is no error handling in query_execute_select() without exceptions
+      //TODO: Seems there is no error handling in DbUtils::query_execute_select() without exceptions
       std::auto_ptr<Glib::Error> error;
-      data_model = query_execute_select(query);
+      data_model = DbUtils::query_execute_select(query);
       if (error.get())
       {
         std::cerr << "Base_DB::get_record_field_values_for_calculation(): Exception while executing SQL: " << query << std::endl;
@@ -1532,10 +1232,10 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
         builder->add_expr_as_value(field_in_record.m_key_value)));
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    try //TODO: The exceptions are probably already handled by query_execute(0.
+    try //TODO: The exceptions are probably already handled by query_execute(
 #endif
     {
-      const bool test = query_execute(builder); //TODO: Respond to failure.
+      const bool test = DbUtils::query_execute(builder); //TODO: Respond to failure.
       if(!test)
       {
         std::cerr << "Box_Data::set_field_value_in_database(): UPDATE failed." << std::endl;
@@ -1598,7 +1298,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
   Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_key(field_in_record.m_table_name,
       list_fields, field_in_record.m_key, field_in_record.m_key_value, 1);
 
-  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(sql_query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(sql_query);
   if(data_model)
   {
     if(data_model->get_n_rows())
@@ -1646,7 +1346,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const sharedptr<Field>& f
     Glib::ustring(), type_sort_clause(), Glib::ustring(),
     1 /* limit */);
 
-  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(sql_query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(sql_query);
   if(data_model)
   {
     if(data_model->get_n_rows())
@@ -1922,7 +1622,7 @@ Gnome::Gda::Value Base_DB::get_lookup_value(const Glib::ustring& /* table_name *
         builder->add_id(to_key_field->get_name()), //TODO: It would be nice to specify the table here too.
         builder->add_expr(value_to_key_field)));
 
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute_select(builder);
+    Glib::RefPtr<Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(builder);
     if(data_model && data_model->get_n_rows())
     {
       //There should be only 1 row. Well, there could be more but we will ignore them.
@@ -1957,7 +1657,7 @@ bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const s
       builder->add_id(field->get_name()), //TODO: It would be nice to specify the table here too.
       builder->add_expr(value)));
 
-  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(builder);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(builder);
   if(data_model)
   {
     //std::cout << "debug: Base_DB::get_field_value_is_unique(): table_name=" << table_name << ", field name=" << field->get_name() << ", value=" << value.to_string() << ", rows count=" << data_model->get_n_rows() << std::endl;
@@ -2174,7 +1874,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query =
     Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsToGet,
       builder->export_expression(cond_id));
-  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(query);
 
   if(data_model && data_model->get_n_rows())
   {
@@ -2209,7 +1909,7 @@ int Base_DB::count_rows_returned_by(const Glib::RefPtr<Gnome::Gda::SqlBuilder>&
   //Be careful not to include ORDER BY clauses in this, because that would make it unnecessarily slow:
   //TODO: Add alias too? const Glib::ustring query_count = "SELECT COUNT (*) FROM (" + sql_query + ") AS glomarbitraryalias";
 
-    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder);
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
     if(datamodel && datamodel->get_n_rows() && datamodel->get_n_columns())
     {
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -2320,7 +2020,7 @@ bool Base_DB::add_user(const Glib::ustring& user, const Glib::ustring& password,
   //strQuery +=  " PASSWORD '" + password + "'" ; //TODO: Escape the password.
 
 
-  bool test = query_execute(strQuery);
+  bool test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::add_user(): CREATE USER failed." << std::endl;
@@ -2329,7 +2029,7 @@ bool Base_DB::add_user(const Glib::ustring& user, const Glib::ustring& password,
 
   //Add it to the group:
   strQuery = "ALTER GROUP \"" + group + "\" ADD USER \"" + user + "\"";
-  test = query_execute(strQuery);
+  test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::add_user(): ALTER GROUP failed." << std::endl;
@@ -2346,7 +2046,7 @@ bool Base_DB::add_user(const Glib::ustring& user, const Glib::ustring& password,
   for(Document::type_listTableInfo::const_iterator iter = table_list.begin(); iter != table_list.end(); ++iter)
   {
     const Glib::ustring strQuery = "REVOKE ALL PRIVILEGES ON \"" + (*iter)->get_name() + "\" FROM \"" + user + "\"";
-    const bool test = query_execute(strQuery);
+    const bool test = DbUtils::query_execute(strQuery);
     if(!test)
       std::cerr << "Base_DB::add_user(): REVOKE failed." << std::endl;
   }
@@ -2361,7 +2061,7 @@ bool Base_DB::remove_user(const Glib::ustring& user)
     return false;
 
   const Glib::ustring strQuery = "DROP USER \"" + user + "\"";
-  const bool test = query_execute(strQuery);
+  const bool test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::remove_user(): DROP USER failed" << std::endl;
@@ -2377,7 +2077,7 @@ bool Base_DB::remove_user_from_group(const Glib::ustring& user, const Glib::ustr
     return false;
 
   const Glib::ustring strQuery = "ALTER GROUP \"" + group + "\" DROP USER \"" + user + "\"";
-  const bool test = query_execute(strQuery);
+  const bool test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::remove_user_from_group(): ALTER GROUP failed." << std::endl;
@@ -2398,7 +2098,7 @@ bool Base_DB::set_database_owner_user(const Glib::ustring& user)
     return false;
 
   const Glib::ustring strQuery = "ALTER DATABASE \"" + database_name + "\" OWNER TO \"" + user + "\"";
-  const bool test = query_execute(strQuery);
+  const bool test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::set_database_owner_user(): ALTER DATABSE failed." << std::endl;
@@ -2422,7 +2122,7 @@ bool Base_DB::disable_user(const Glib::ustring& user)
   }
 
   const Glib::ustring strQuery = "ALTER ROLE \"" + user + "\" NOLOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE";
-  const bool test = query_execute(strQuery);
+  const bool test = DbUtils::query_execute(strQuery);
   if(!test)
   {
     std::cerr << "Base_DB::remove_user(): DROP USER failed" << std::endl;
diff --git a/glom/base_db.h b/glom/base_db.h
index 5292297..7bc2c04 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -74,25 +74,6 @@ public:
   virtual void set_document(Document* pDocument); //View override
   virtual void load_from_document(); //View override
 
-  /** Execute a SQL Select command, returning the result.
-   * This method handles any Gda exceptions caused by executing the command.
-   */
-  static Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(
-    const Glib::ustring& strQuery,
-    const Glib::RefPtr<Gnome::Gda::Set>& params = Glib::RefPtr<Gnome::Gda::Set>(0));
-  static Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(
-     const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
-     const Glib::RefPtr<const Gnome::Gda::Set>& params = Glib::RefPtr<const Gnome::Gda::Set>(0));
-
-
-  /** Execute a SQL non-select command, returning true if it succeeded.
-   * This method handles any Gda exceptions caused by executing the command.
-   */
-  static bool query_execute(const Glib::ustring& strQuery,
-                            const Glib::RefPtr<Gnome::Gda::Set>& params = Glib::RefPtr<Gnome::Gda::Set>(0));
-  static bool query_execute(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
-                            const Glib::RefPtr<const Gnome::Gda::Set>& params = Glib::RefPtr<const Gnome::Gda::Set>(0));
-
   static int count_rows_returned_by(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& sql_query);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index 2258aa6..1cb05c6 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -228,7 +228,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
   if(!strNames.empty() && !strValues.empty())
   {
     const Glib::ustring strQuery = "INSERT INTO \"" + m_table_name + "\" (" + strNames + ") VALUES (" + strValues + ")";
-    const bool test = query_execute(strQuery, params);
+    const bool test = DbUtils::query_execute(strQuery, params);
     if(!test)
       std::cerr << "Box_Data::record_new(): INSERT failed." << std::endl;
     else
@@ -290,7 +290,7 @@ bool Base_DB_Table_Data::get_related_record_exists(const sharedptr<const Relatio
       builder->add_id(to_field), //TODO: It would be nice to specify the table here too.
       builder->add_expr(key_value)));
                                                
-  Glib::RefPtr<Gnome::Gda::DataModel> records = query_execute_select(builder);
+  Glib::RefPtr<Gnome::Gda::DataModel> records = DbUtils::query_execute_select(builder);
   if(!records)
     handle_error();
   else
@@ -381,7 +381,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
       Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
       params->add_holder(primary_key_field->get_holder(primary_key_value));
       const Glib::ustring strQuery = "INSERT INTO \"" + relationship->get_to_table() + "\" (\"" + primary_key_field->get_name() + "\") VALUES (" + primary_key_field->get_gda_holder_string() + ")";
-      const bool test = query_execute(strQuery, params);
+      const bool test = DbUtils::query_execute(strQuery, params);
       if(!test)
       {
         std::cerr << "Base_DB_Table_Data::add_related_record_for_field(): INSERT failed." << std::endl;
@@ -436,7 +436,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
                 builder->add_expr(parent_primary_key_value)),
             */
           
-            const bool test = query_execute(strQuery, params);
+            const bool test = DbUtils::query_execute(strQuery, params);
             if(!test)
             {
               std::cerr << "Base_DB_Table_Data::add_related_record_for_field(): UPDATE failed." << std::endl;
@@ -491,7 +491,7 @@ bool Base_DB_Table_Data::record_delete(const Gnome::Gda::Value& primary_key_valu
   {
     Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
     params->add_holder(field_primary_key->get_holder(primary_key_value));
-    return query_execute( "DELETE FROM \"" + m_table_name + "\" WHERE \"" + m_table_name + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->get_gda_holder_string(), params);
+    return DbUtils::query_execute( "DELETE FROM \"" + m_table_name + "\" WHERE \"" + m_table_name + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->get_gda_holder_string(), params);
   }
   else
   {
@@ -522,7 +522,7 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
     Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(field_in_record_changed.m_table_name, fieldsToGet, field_in_record_changed.m_key, field_in_record_changed.m_key_value);
     //std::cout << "DEBUG: Base_DB_Table_Data::refresh_related_fields(): query=" << query << std::endl;
 
-    Glib::RefPtr<const Gnome::Gda::DataModel> result = query_execute_select(query);
+    Glib::RefPtr<const Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
     if(!result)
     {
       std::cerr << "Base_DB_Table_Data::refresh_related_fields(): no result." << std::endl;
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index de9b26c..48d21fd 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -690,7 +690,7 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause, found_set.m_extra_group_by);
 
   //TODO: Lock the database (prevent changes) during export.
-  Glib::RefPtr<Gnome::Gda::DataModel> result = query_execute_select(query);
+  Glib::RefPtr<Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
 
   guint rows_count = 0;
   if(result)
@@ -740,7 +740,7 @@ void Frame_Glom::export_data_to_string(Glib::ustring& the_string, const FoundSet
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause, found_set.m_extra_group_by);
 
   //TODO: Lock the database (prevent changes) during export.
-  Glib::RefPtr<const Gnome::Gda::DataModel> result = query_execute_select(query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
 
   guint rows_count = 0;
   if(result)
@@ -792,7 +792,7 @@ void Frame_Glom::export_data_to_stream(std::ostream& the_stream, const FoundSet&
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause, found_set.m_extra_group_by);
 
   //TODO: Lock the database (prevent changes) during export.
-  Glib::RefPtr<const Gnome::Gda::DataModel> result = query_execute_select(query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
 
   guint rows_count = 0;
   if(result)
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 8a9ac08..1cdfa34 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1526,98 +1526,6 @@ bool insert_example_data(Document* document, const Glib::ustring& table_name)
 }
 
 //static:
-Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(const Glib::ustring& strQuery,
-                                                                  const Glib::RefPtr<Gnome::Gda::Set>& params)
-{
-  Glib::RefPtr<Gnome::Gda::DataModel> result;
-
-  //TODO: BusyCursor busy_cursor(get_app_window());
-
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = get_connection();
-  if(!gda_connection)
-  {
-    std::cerr << "query_execute_select(): No connection yet." << std::endl;
-    return result;
-  }
-
-  Glib::RefPtr<Gnome::Gda::SqlParser> parser = gda_connection->create_parser();
-
-  Glib::RefPtr<Gnome::Gda::Statement> stmt;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    stmt = parser->parse_string(strQuery);
-  }
-  catch(const Gnome::Gda::SqlParserError& ex)
-  {
-    std::cout << "debug: query_execute_select(): SqlParserError: exception from parse_string(): " << ex.what() << std::endl;
-  }
-#else
-  std::auto_ptr<Glib::Error> ex;
-  stmt = parser->parse_string(strQuery, ex);
-  if(error.get())
-     std::cout << "debug: query_execute_select(): SqlParserError: exception from parse_string(): " << error->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-
-  //Debug output:
-  if(stmt && ConnectionPool::get_instance()->get_show_debug_output())
-  {
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-    try
-    {
-      const Glib::ustring full_query = stmt->to_sql(params);
-      std::cout << "Debug: query_execute_select():  " << full_query << std::endl;
-    }
-    catch(const Glib::Exception& ex)
-    {
-      std::cout << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
-    }
-#else
-      const Glib::ustring full_query = stmt->to_sql(params, ex);
-      std::cout << "Debug: query_execute_select():  " << full_query << std::endl;
-      if (ex.get())
-        std::cout << "Debug: query string could not be converted to std::cout: " << ex->what() << std::endl;
-
-#endif
-  }
-
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-    result = gda_connection->statement_execute_select(stmt, params);
-  }
-  catch(const Gnome::Gda::ConnectionError& ex)
-  {
-    std::cout << "debug: query_execute_select(): ConnectionError: exception from statement_execute_select(): " << ex.what() << std::endl;
-  }
-  catch(const Gnome::Gda::ServerProviderError& ex)
-  {
-    std::cout << "debug: query_execute_select(): ServerProviderError: exception from statement_execute_select(): code=" << ex.code() << "message=" << ex.what() << std::endl;
-  }
-  catch(const Glib::Error& ex)
-  {
-    std::cout << "debug: query_execute_select(): Error: exception from statement_execute_select(): " << ex.what() << std::endl;
-  }
-
-#else
-  result = gda_connection->statement_execute_select(stmt, params, ex);
-  if(ex.get())
-    std::cout << "debug: query_execute_select(): Glib::Error from statement_execute_select(): " << ex->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  if(!result)
-  {
-    std::cerr << "Glom  query_execute_select(): Error while executing SQL" << std::endl <<
-      "  " <<  strQuery << std::endl;
-    handle_error();
-  }
-
-  return result;
-}
-
-//static:
 Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
   const Glib::RefPtr<const Gnome::Gda::Set>& params)
 {
diff --git a/glom/libglom/db_utils.h b/glom/libglom/db_utils.h
index 205f41f..7f7b5b4 100644
--- a/glom/libglom/db_utils.h
+++ b/glom/libglom/db_utils.h
@@ -74,11 +74,6 @@ bool insert_example_data(Document* document, const Glib::ustring& table_name);
 
 /** Execute a SQL Select command, returning the result.
   */
-Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(const Glib::ustring& strQuery,
-  const Glib::RefPtr<Gnome::Gda::Set>& params = Glib::RefPtr<Gnome::Gda::Set>(0));
-
-/** Execute a SQL Select command, returning the result.
-  */
 Glib::RefPtr<Gnome::Gda::DataModel> query_execute_select(
   const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder,
   const Glib::RefPtr<const Gnome::Gda::Set>& params = Glib::RefPtr<const Gnome::Gda::Set>(0));
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 666a413..d2103ce 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -23,6 +23,7 @@
 #include <glom/utils_ui.h>
 #include <glom/application.h>
 #include <libglom/data_structure/glomconversions.h>
+#include <libglom/db_utils.h>
 #include <glom/frame_glom.h> //For show_ok_dialog()
 #include <glom/glade_utils.h>
 #include <glibmm/i18n.h>
@@ -198,7 +199,7 @@ bool Box_Data_Calendar_Related::fill_from_database()
 
     Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_where_clause(m_found_set.m_table_name, m_FieldsShown, where_clause, m_found_set.m_extra_join, m_found_set.m_sort_clause, m_found_set.m_extra_group_by);
     //std::cout << "DEBUG: sql_query=" << sql_query << std::endl;
-    Glib::RefPtr<const Gnome::Gda::DataModel> datamodel = query_execute_select(sql_query);
+    Glib::RefPtr<const Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(sql_query);
     if(!(datamodel))
       return true;
 
@@ -306,7 +307,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary
           builder->add_id(field_primary_key->get_name()),
           builder->add_expr_as_value(primary_key_value)));
 
-      const bool test = query_execute(builder);
+      const bool test = DbUtils::query_execute(builder);
       if(test)
       {
         //Show it on the view, if it's visible:
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 0e64ee6..a7987e5 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -359,7 +359,7 @@ bool Box_Data_Details::fill_from_database()
         Glib::RefPtr<Gnome::Gda::DataModel> result;
 
         if(!primary_key_is_empty)
-          result = query_execute_select(query);
+          result = DbUtils::query_execute_select(query);
 
         if((result && result->get_n_rows()) || primary_key_is_empty) //either a working result or no result needed.
         {
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 294fd9f..df041c6 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -20,6 +20,7 @@
 
 #include <glom/mode_data/box_data_portal.h>
 #include <libglom/data_structure/glomconversions.h>
+#include <libglom/db_utils.h>
 #include <glom/glade_utils.h>
 #include <glom/frame_glom.h> //For show_ok_dialog()
 #include <glom/utils_ui.h> //For bold_message()).
@@ -117,7 +118,7 @@ void Box_Data_Portal::make_record_related(const Gnome::Gda::Value& related_recor
         builder->add_expr_as_value(related_record_primary_key_value)));
 
   //std::cout << "Box_Data_Portal::make_record_related(): setting value in db=" << primary_key_value.to_string() << std::endl;
-  const bool test = query_execute(builder);
+  const bool test = DbUtils::query_execute(builder);
   if(!test)
   {
     std::cerr << "Box_Data_Portal::make_record_related(): SQL query failed." << std::endl;
@@ -513,7 +514,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
   //std::cout << "DEBUG: related table=" << related_table << ", whose primary_key=" << key_field->get_name() << std::endl;
 
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(related_table, fieldsToGet, key_field, primary_key_value);
-  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(query);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(query);
 
 
   bool value_found = true;
diff --git a/glom/mode_design/dialog_database_preferences.cc b/glom/mode_design/dialog_database_preferences.cc
index bdde001..28c8dcf 100644
--- a/glom/mode_design/dialog_database_preferences.cc
+++ b/glom/mode_design/dialog_database_preferences.cc
@@ -139,7 +139,7 @@ void Dialog_Database_Preferences::on_treeview_cell_edited_next_value(const Glib:
           builder->add_id(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_FIELD_NAME),
           builder->add_expr(field_name))));
 
-    const bool test = query_execute(builder);
+    const bool test = DbUtils::query_execute(builder);
     if(!test)
       std::cerr << "Dialog_Database_Preferences::on_treeview_cell_edited_next_value(): UPDATE failed." << std::endl;
   }
@@ -184,7 +184,7 @@ void Dialog_Database_Preferences::load_from_document()
   
   NumericFormat numeric_format; //ignored
 
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
   if(!datamodel)
   {
     std::cerr << "Dialog_Database_Preferences::load_from_document(): Gda::DataModel is NULL." << std::endl;
diff --git a/glom/mode_design/fields/box_db_table_definition.cc b/glom/mode_design/fields/box_db_table_definition.cc
index 640a399..b374829 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -633,7 +633,7 @@ bool Box_DB_Table_Definition::field_has_null_values(const sharedptr<const Field>
       builder->add_id(field->get_name()))); //TODO: It would nice to specify the table name here too.
 
   long null_count = 0;
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
   if(datamodel)
   {
     if(datamodel->get_n_rows() && datamodel->get_n_columns())
@@ -661,7 +661,7 @@ bool Box_DB_Table_Definition::field_has_non_unique_values(const sharedptr<const
   builder_query_distinct->set_table(m_table_name);
   builder_query_distinct->select_add_field(field->get_name(), m_table_name);
 
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder_query_distinct);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder_query_distinct);
   if(datamodel)
   {
     count_distinct = datamodel->get_n_rows();
@@ -678,7 +678,7 @@ bool Box_DB_Table_Definition::field_has_non_unique_values(const sharedptr<const
   builder_query_all->select_add_field(field->get_name(), m_table_name);
   builder_query_all->select_add_target(m_table_name);
       
-  datamodel = query_execute_select(builder_query_all);
+  datamodel = DbUtils::query_execute_select(builder_query_all);
   if(datamodel)
   {
     count_all = datamodel->get_n_rows();
diff --git a/glom/mode_design/users/dialog_groups_list.cc b/glom/mode_design/users/dialog_groups_list.cc
index 501f5ce..5002485 100644
--- a/glom/mode_design/users/dialog_groups_list.cc
+++ b/glom/mode_design/users/dialog_groups_list.cc
@@ -223,7 +223,7 @@ void Dialog_GroupsList::on_button_group_delete()
         if(response == Gtk::RESPONSE_OK)
         {
           Glib::ustring strQuery = "DROP GROUP \"" + group + "\"";
-          const bool test = query_execute(strQuery);
+          const bool test = DbUtils::query_execute(strQuery);
           if(!test)
             std::cerr << "Box_DB_Table_Definition::on_adddel_delete(): DROP GROUP failed." << std::endl;
 
@@ -253,7 +253,7 @@ void Dialog_GroupsList::on_button_group_new()
   if(!group_name.empty())
   {
     const Glib::ustring strQuery = "CREATE GROUP \"" + group_name + "\"";
-    const bool test = query_execute(strQuery);
+    const bool test = DbUtils::query_execute(strQuery);
     if(!test)
       std::cout << "Dialog_GroupsList::on_button_group_new(): CREATE GROUP failed." << std::endl;
 
@@ -480,7 +480,7 @@ bool Dialog_GroupsList::set_table_privilege(const Glib::ustring& table_name, con
 
   strQuery += " GROUP \"" + group_name + "\"";
 
-  const bool test = query_execute(strQuery); //TODO: Handle errors.
+  const bool test = DbUtils::query_execute(strQuery); //TODO: Handle errors.
   if(!test)
     std::cerr << "Dialog_GroupsList::set_table_privilege(): GRANT/REVOKE failed." << std::endl;
 
diff --git a/glom/mode_design/users/dialog_users_list.cc b/glom/mode_design/users/dialog_users_list.cc
index fd8577d..8ff983b 100644
--- a/glom/mode_design/users/dialog_users_list.cc
+++ b/glom/mode_design/users/dialog_users_list.cc
@@ -22,6 +22,7 @@
 #include "dialog_user.h"
 #include "dialog_choose_user.h"
 #include <libglom/privs.h>
+#include <libglom/db_utils.h>
 #include <glom/glade_utils.h>
 #include <glom/utils_ui.h> //For bold_message()).
 //#include <libgnome/gnome-i18n.h>
@@ -202,7 +203,7 @@ void Dialog_UsersList::on_button_user_add()
   {
     //Add it to the group:
     const Glib::ustring strQuery = "ALTER GROUP \"" + m_combo_group->get_active_text() + "\" ADD USER \"" + user + "\"";
-    const bool test = query_execute(strQuery);
+    const bool test = DbUtils::query_execute(strQuery);
     if(!test)
       std::cerr << "Dialog_UsersList::on_button_user_add(): ALTER GROUP failed." << std::endl;
 
@@ -212,7 +213,7 @@ void Dialog_UsersList::on_button_user_add()
     for(Document::type_listTableInfo::const_iterator iter = table_list.begin(); iter != table_list.end(); ++iter)
     {
       const Glib::ustring strQuery = "REVOKE ALL PRIVILEGES ON \"" + (*iter)->get_name() + "\" FROM \"" + user + "\"";
-      const bool test = query_execute(strQuery);
+      const bool test = DbUtils::query_execute(strQuery);
       if(!test)
         std::cerr << "Dialog_UsersList::on_button_user_add(): REVOKE failed." << std::endl;
     }
@@ -319,7 +320,7 @@ void Dialog_UsersList::on_button_user_edit()
       if(!user.empty() && !password.empty())
       {
         const Glib::ustring strQuery = "ALTER USER \"" + user + "\" PASSWORD '" + password + "'" ; //TODO: Escape the password.
-        const bool test = query_execute(strQuery);
+        const bool test = DbUtils::query_execute(strQuery);
         if(!test)
           std::cerr << "Dialog_UsersList::on_button_user_edit(): ALTER USER failed." << std::endl;
 
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index c513528..2a0d097 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -313,7 +313,7 @@ void Box_Tables::on_adddel_Delete(const Gtk::TreeModel::iterator& rowStart, cons
           //Delete the table:
           if(iButtonClicked == Gtk::RESPONSE_OK)
           {
-            const bool test = query_execute( "DROP TABLE \"" + table_name + "\"");
+            const bool test = DbUtils::query_execute( "DROP TABLE \"" + table_name + "\"");
             if(!test)
               std::cerr << "Box_Tables::on_adddel_Delete(): DROP TABLE failed." << std::endl;
             else
@@ -386,7 +386,7 @@ void Box_Tables::on_adddel_changed(const Gtk::TreeModel::iterator& row, guint co
         //Rename the table:
         if(iButtonClicked == Gtk::RESPONSE_OK)
         {
-          const bool test = query_execute( "ALTER TABLE \"" + table_name + "\" RENAME TO \"" + table_name_new + "\"");
+          const bool test = DbUtils::query_execute( "ALTER TABLE \"" + table_name + "\" RENAME TO \"" + table_name_new + "\"");
           if(test)
           {
             //Change the AddDel item's key:
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index ce24fdf..4501b30 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -30,6 +30,7 @@
 #include <glom/utility_widgets/canvas/canvas_image_movable.h>
 #include <glom/utility_widgets/canvas/canvas_text_movable.h>
 #include <libglom/data_structure/glomconversions.h>
+#include <libglom/db_utils.h>
 
 #include <glom/glade_utils.h>
 #include <glibmm/i18n.h>
@@ -636,7 +637,7 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
   try
   {
   #endif
-    datamodel = query_execute_select(sql_query);
+    datamodel = DbUtils::query_execute_select(sql_query);
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(const Glib::Exception& ex)
@@ -733,7 +734,7 @@ void Canvas_PrintLayout::fill_with_data_portal(const Glib::RefPtr<CanvasLayoutIt
 
   Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fields_shown, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause, found_set.m_extra_group_by);
   //std::cout << "DEBUG: sql_query=" << sql_query << std::endl;
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(sql_query);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(sql_query);
   if(!(datamodel))
     return;
     
diff --git a/glom/report_builder.cc b/glom/report_builder.cc
index 4a2bfcc..291bb90 100644
--- a/glom/report_builder.cc
+++ b/glom/report_builder.cc
@@ -26,6 +26,7 @@
 #include <libglom/data_structure/layout/report_parts/layoutitem_verticalgroup.h>
 #include <libglom/data_structure/layout/report_parts/layoutitem_header.h>
 #include <libglom/data_structure/layout/report_parts/layoutitem_footer.h>
+#include <libglom/db_utils.h>
 #include <glom/xsl_utils.h>
 
 namespace Glom
@@ -189,7 +190,7 @@ void ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
 
     builder->select_group_by( builder->add_id(field_group_by->get_name()) ); //TODO: And restrict to the current found set.
 
-    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder);
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
     if(datamodel)
     {
       guint rows_count = datamodel->get_n_rows();
@@ -327,7 +328,7 @@ void ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
       limit);
 
     bool records_found = false;
-    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(sql_query);
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(sql_query);
     if(datamodel)
     {
       const guint rows_count = datamodel->get_n_rows();
@@ -401,7 +402,7 @@ void ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
     builder->set_table(field->get_table_used(found_set.m_table_name));
     builder->select_add_field(field->get_name(), found_set.m_table_name);
     builder->select_set_limit(1);
-    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(builder);
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
 
     if(!datamodel)
       return;



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