glom r1856 - in trunk: . glom glom/libglom/data_structure glom/mode_data glom/mode_design/users glom/navigation glom/utility_widgets/db_adddel



Author: jhs
Date: Fri Jan 23 21:42:35 2009
New Revision: 1856
URL: http://svn.gnome.org/viewvc/glom?rev=1856&view=rev

Log:
2009-01-23  Johannes Schmid  <jhs openismus com>

	* glom/base_db.cc:
	* glom/base_db.h:
	Refactored query_execute() to be able to use additional parameters. Changed
	insert_example_data() to use the new method.
	
	* glom/libglom/data_structure/field.cc:
	* glom/libglom/data_structure/field.h:
	Added get_gda_g_type() and made get_gda_type() should a wrapper around it
	
	* glom/base_db_table_data.cc:
	* glom/dialog_database_preferences.cc:
	* glom/mode_data/box_data_calendar_related.cc:
	* glom/mode_data/box_data_list_related.cc:
	* glom/mode_design/users/dialog_groups_list.cc:
	* glom/mode_design/users/dialog_users_list.cc:
	* glom/navigation/box_tables.cc:
	* glom/utility_widgets/db_adddel/glom_db_treemodel.cc:
	Removed the unused Gtk::Window* parameter from all query_execute() calls

Modified:
   trunk/ChangeLog
   trunk/glom/base_db.cc
   trunk/glom/base_db.h
   trunk/glom/base_db_table_data.cc
   trunk/glom/dialog_database_preferences.cc
   trunk/glom/libglom/data_structure/field.cc
   trunk/glom/libglom/data_structure/field.h
   trunk/glom/mode_data/box_data_calendar_related.cc
   trunk/glom/mode_data/box_data_list_related.cc
   trunk/glom/mode_design/users/dialog_groups_list.cc
   trunk/glom/mode_design/users/dialog_users_list.cc
   trunk/glom/navigation/box_tables.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Fri Jan 23 21:42:35 2009
@@ -230,13 +230,11 @@
   return result;
 }
 
-
 //static:
-bool Base_DB::query_execute(const Glib::ustring& strQuery, Gtk::Window* /* parent_window */)
+bool Base_DB::query_execute(const Glib::ustring& strQuery,
+                            const Glib::RefPtr<Gnome::Gda::Set>& params)
 {
-  //TODO: Bakery::BusyCursor busy_cursor(get_app_window());
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
   sharedptr<SharedConnection> sharedconnection = connect_to_server();
 #else
   std::auto_ptr<ExceptionConnection> error;
@@ -252,9 +250,7 @@
     std::cerr << "Base_DB::query_execute(): No connection yet." << std::endl;
     return false;
   }
-
-  Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
-
+  
   const App_Glom* app = App_Glom::get_application();
   if(app && app->get_show_sql_debug())
   {
@@ -262,51 +258,59 @@
     try
     {
 #endif
-      std::cout << "Debug: Base_DB::query_execute():  " << strQuery << std::endl;
+      std::cerr << "Debug: Base_DB::query_execute():  " << strQuery << std::endl;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     }
     catch(const Glib::Exception& ex)
     {
-      std::cout << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
+      std::cerr << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
     }
 #endif
   }
-
+  
+  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
-  int execute_result = -1;
   try
   {
-    execute_result = gda_connection->statement_execute_non_select(strQuery);
+    stmt = parser->parse_string(strQuery);
+  }
+  catch(const Gnome::Gda::SqlParserError& error)
+  {
+    std::cerr << "DEBUG: BaseDB::query_execute: " << error.what() << std::endl;
+    return false;
+  }
+#else
+  std::auto_ptr<Glib::Error> sql_error;
+  stmt = parser->parse_string(strQuery, sql_error);
+  if(sql_error)
+  {
+    std::cerr << "DEBUG: BaseDB::query_execute: " << error.what() << std::endl;
+    return false;
   }
-  catch(const Gnome::Gda::ConnectionError& ex)
+#endif
+  int exec_retval = -1;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
   {
-    std::cout << "debug: Base_DB::query_execute(): ConnectionError: exception from execute_non_select_command(): " << ex.what() << std::endl;
+    exec_retval = gda_connection->statement_execute_non_select (stmt, params);
   }
-  catch(const Gnome::Gda::ServerProviderError& ex)
+  catch(const Glib::Error& error)
   {
-    std::cout << "debug: Base_DB::query_execute(): ServerProviderError: exception from execute_non_select_command(): " << ex.what() << std::endl;
+    std::cerr << "BaseDB::query_execute: " << error.what() << std::endl;
+    return false;
   }
-	catch(const Gnome::Gda::SqlParserError& ex)
-	{
-		std::cout << "debug: Base_DB::query_execute(): SqlParserError:" << ex.what() << std::endl;
-		std::cout << "debug: query was: " << strQuery << std::endl;
-	}
 #else
-  std::auto_ptr<Glib::Error> error;
-  execute_result = gda_connection->gda_connection->statement_execute_non_select(strQuery, error);
-  if(error)
-    std::cout << "debug: Base_DB::query_execute(): Glib::Error from statement_execute_non_select(): " << error->what() << std::endl;
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-      
-  if(execute_result == -1) //-1 from statement_execute_non_select() means an error.
+  std_autoptr<Glib::Error> exec_error;
+  exec_retval = gda_connection->statement_execute_non_select (stmt, params, exec_error);
+  if(exec_error)
   {
-    std::cerr << "Glom  Base_DB::query_execute(): Error while executing SQL" << std::endl <<
-      "  " <<  strQuery << std::endl;
-    handle_error();
+    std::cerr << "BaseDB::query_execute: " << error.what() << std::endl;
     return false;
   }
-  
-  return true;
+#endif
+  return (exec_retval >= 0);
 }
 
 void Base_DB::load_from_document()
@@ -1506,6 +1510,7 @@
       //Note that this is checking for newlines ("\n"), not escaped newlines ("\\n").
       if(row_data.find("\n") == Glib::ustring::npos)
       {
+        Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
         for(unsigned int i = 0; i < vec_values.size(); ++i)
         {
           if(i > 0)
@@ -1516,91 +1521,40 @@
 
           strNames += vec_fields[i]->get_name();
 
-          //Add a SQL parameter placeholder for the value:
-          strVals += "##" + vec_fields[i]->get_name() + "::" + vec_fields[i]->get_gda_type();              
+          bool success = false;
+          Gnome::Gda::Value value = vec_fields[i]->from_sql(vec_values[i], Field::SQL_FORMAT_POSTGRES, success);
+          if(!success)
+          {
+            std::cerr << "Base_DB::insert_example_data: could not convert example data" << std::endl;
+            continue;
+          }
+          
+          //Add a SQL parameter for the value:
+          Glib::ustring param_name = Glib::ustring::compose("param%1", i);
+          Glib::RefPtr<Gnome::Gda::Holder> holder = Gnome::Gda::Holder::create(vec_fields[i]->get_gda_g_type(),
+                                                                               param_name);
+
+          holder->set_not_null(false);
+          holder->set_value(value);
+          params->add_holder(holder);
+          
+          strVals += "##" + param_name + "::" + vec_fields[i]->get_gda_type();
         }
 
         //Create and parse the SQL query:
         //After this, the Parser will know how many SQL parameters there are in 
         //the query, and allow us to set their values.
         const Glib::ustring strQuery = "INSERT INTO \"" + table_name + "\" (" + strNames + ") VALUES (" + strVals + ")";
-        //std::cout << "debug: BaseDB::insert_exampledata: " << strQuery << std::endl;
-        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::cout << "DEBUG: BaseDB::insert_exampledata: " << error.what() << std::endl;
-          insert_succeeded = false;
-          break;
-        }
-#else
-        std::auto_ptr<Glib::Error> sql_error;
-        stmt = parser->parse_string(strQuery, sql_error);
-        if(sql_error)
-        {
-          std::cout << "DEBUG: BaseDB::insert_exampledata: " << error.what() << std::endl;
-          insert_succeeded = false;
+        params->reference(); // bug in libgda or libgdamm?
+        insert_succeeded = query_execute(strQuery, params);
+        if (!insert_succeeded)
           break;
-        }
-#endif
-
-        Glib::RefPtr<Gnome::Gda::Set> params;
-        stmt->get_parameters(params);
-        for(unsigned int i = 0; i < vec_values.size(); ++i)
-        {
-          Glib::RefPtr<Gnome::Gda::Holder> holder = params->get_holder(vec_fields[i]->get_name());
-          if(holder)
-          {
-            //Note that the file format always uses the Postgres field format, 
-            //even if the data will be inserted into a SQL database, so that 
-            //the file is not different just because of the backend:
-            bool success = false;
-            Gnome::Gda::Value value = vec_fields[i]->from_sql(vec_values[i], Field::SQL_FORMAT_POSTGRES, success);
-            if(!success)
-            {
-              std::cerr << "Base_DB::insert_example_data: could not convert example data" << std::endl;
-              continue;
-            }
-
-            holder->set_not_null(false); // some values might be null */
-            holder->set_value(value);
-          }
-          else
-            std::cerr << "Base_DB::insert_example_data: Missing holder: " << vec_fields[i]->get_name() << std::endl;
-        }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-        try
-        {
-          gda_connection->statement_execute_non_select (stmt, params);
-        }
-        catch(const Glib::Error& error)
-        {
-          std::cout << "BaseDB::insert_exampledata: " << error.what() << std::endl;
-          insert_succeeded = false;
-          break;
-        }
-#else
-        std_autoptr<Glib::Error> exec_error;
-        gda_connection->statement_execute_non_select (stmt, params, exec_error);
-        if(exec_error)
-        {
-          std::cout << "BaseDB::insert_exampledata: " << error.what() << std::endl;
-          insert_succeeded = false;
-          break;
-        }
-#endif
       }
       else
       {
         std::cerr << "Glom: Base_DB::insert_example_data(): nested newline found in row data: " << row_data << std::endl;
       }
     }
-    insert_succeeded = true;
   }
 
   for(Document_Glom::type_vecFields::const_iterator iter = vec_fields.begin(); iter != vec_fields.end(); ++iter)
@@ -2440,7 +2394,7 @@
     try //TODO: The exceptions are probably already handled by query_execute(0.
 #endif
     {
-      const bool test = query_execute(strQuery, parent_window); //TODO: Respond to failure.
+      const bool test = query_execute(strQuery); //TODO: Respond to failure.
       if(!test)
       {
         std::cerr << "Box_Data::set_field_value_in_database(): UPDATE failed." << std::endl;

Modified: trunk/glom/base_db.h
==============================================================================
--- trunk/glom/base_db.h	(original)
+++ trunk/glom/base_db.h	Fri Jan 23 21:42:35 2009
@@ -87,7 +87,8 @@
   /** 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, Gtk::Window* parent_window = 0);
+  static bool query_execute(const Glib::ustring& strQuery,
+                            const Glib::RefPtr<Gnome::Gda::Set>& params = Glib::RefPtr<Gnome::Gda::Set>(0));
 
   static int count_rows_returned_by(const Glib::ustring& sql_query);
 

Modified: trunk/glom/base_db_table_data.cc
==============================================================================
--- trunk/glom/base_db_table_data.cc	(original)
+++ trunk/glom/base_db_table_data.cc	Fri Jan 23 21:42:35 2009
@@ -207,7 +207,7 @@
   if(!strNames.empty() && !strValues.empty())
   {
     const Glib::ustring strQuery = "INSERT INTO \"" + m_table_name + "\" (" + strNames + ") VALUES (" + strValues + ")";
-    const bool test = query_execute(strQuery, App_Glom::get_application());
+    const bool test = query_execute(strQuery);
     if(!test)
       std::cerr << "Box_Data::record_new(): INSERT failed." << std::endl;
     else
@@ -350,7 +350,7 @@
       }
 
       const Glib::ustring strQuery = "INSERT INTO \"" + relationship->get_to_table() + "\" (\"" + primary_key_field->get_name() + "\") VALUES (" + primary_key_field->sql(primary_key_value) + ")";
-      const bool test = query_execute(strQuery, App_Glom::get_application());
+      const bool test = query_execute(strQuery);
       if(!test)
       {
         std::cerr << "Base_DB_Table_Data::add_related_record_for_field(): INSERT failed." << std::endl;
@@ -392,7 +392,7 @@
           {
             const Glib::ustring strQuery = "UPDATE \"" + relationship->get_from_table() + "\" SET \"" + relationship->get_from_field() + "\" = " + primary_key_field->sql(primary_key_value) +
               " WHERE \"" + relationship->get_from_table() + "\".\"" + parent_primary_key_field->get_name() + "\" = " + parent_primary_key_field->sql(parent_primary_key_value);
-            const bool test = query_execute(strQuery, App_Glom::get_application());
+            const bool test = query_execute(strQuery);
             if(!test)
             {
               std::cerr << "Base_DB_Table_Data::add_related_record_for_field(): UPDATE failed." << std::endl;
@@ -445,7 +445,7 @@
   sharedptr<Field> field_primary_key = get_field_primary_key();
   if(field_primary_key && !Conversions::value_is_empty(primary_key_value))
   {
-    return query_execute( "DELETE FROM \"" + m_table_name + "\" WHERE \"" + m_table_name + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->sql(primary_key_value), App_Glom::get_application());
+    return query_execute( "DELETE FROM \"" + m_table_name + "\" WHERE \"" + m_table_name + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->sql(primary_key_value));
   }
   else
   {

Modified: trunk/glom/dialog_database_preferences.cc
==============================================================================
--- trunk/glom/dialog_database_preferences.cc	(original)
+++ trunk/glom/dialog_database_preferences.cc	Fri Jan 23 21:42:35 2009
@@ -101,7 +101,7 @@
         " WHERE \"" GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_TABLE_NAME "\" = '" + table_name + "' AND "
                "\"" GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_FIELD_NAME "\" = '" + field_name +"'";
 
-    const bool test = query_execute(sql_query, this);
+    const bool test = query_execute(sql_query);
     if(!test)
       std::cerr << "Dialog_Database_Preferences::on_treeview_cell_edited_next_value(): UPDATE failed." << std::endl;
   }

Modified: trunk/glom/libglom/data_structure/field.cc
==============================================================================
--- trunk/glom/libglom/data_structure/field.cc	(original)
+++ trunk/glom/libglom/data_structure/field.cc	Fri Jan 23 21:42:35 2009
@@ -716,27 +716,32 @@
   }
 }
 
-Glib::ustring Field::get_gda_type() const
+GType Field::get_gda_g_type() const
 {
   switch(m_glom_type)
   {
     case TYPE_NUMERIC:
-      return g_type_name(GDA_TYPE_NUMERIC);
+      return GDA_TYPE_NUMERIC;
     case TYPE_TEXT:
-      return g_type_name(G_TYPE_STRING);
+      return G_TYPE_STRING;
     case TYPE_DATE:
-      return g_type_name(G_TYPE_DATE);
+      return G_TYPE_DATE;
     case TYPE_TIME:
-      return g_type_name(GDA_TYPE_TIME);
+      return GDA_TYPE_TIME;
     case TYPE_BOOLEAN:
-      return g_type_name(G_TYPE_BOOLEAN);
+      return G_TYPE_BOOLEAN;
     case TYPE_IMAGE:
-      return g_type_name(GDA_TYPE_BINARY);
+      return GDA_TYPE_BINARY;
     default:
       g_assert_not_reached();
   }
 }
 
+Glib::ustring Field::get_gda_type() const
+{
+  return g_type_name(get_gda_g_type());
+}
+
 /// Ignores any part of FieldAttributes that libgda does not properly fill.
 bool Field::field_info_from_database_is_equal(const Glib::RefPtr<const Gnome::Gda::Column>& field)
 {

Modified: trunk/glom/libglom/data_structure/field.h
==============================================================================
--- trunk/glom/libglom/data_structure/field.h	(original)
+++ trunk/glom/libglom/data_structure/field.h	Fri Jan 23 21:42:35 2009
@@ -160,6 +160,7 @@
 
   Glib::ustring get_sql_type() const;
   Glib::ustring get_gda_type() const;
+  GType get_gda_g_type() const;
 
   /** Escape the value so that it can be used in a SQL command.
    */

Modified: trunk/glom/mode_data/box_data_calendar_related.cc
==============================================================================
--- trunk/glom/mode_data/box_data_calendar_related.cc	(original)
+++ trunk/glom/mode_data/box_data_calendar_related.cc	Fri Jan 23 21:42:35 2009
@@ -276,7 +276,7 @@
       Glib::ustring strQuery = "UPDATE \"" + m_portal->get_table_used(Glib::ustring() /* not relevant */) + "\"";
       strQuery += " SET \"" +  /* get_table_name() + "." +*/ m_key_field->get_name() + "\" = " + m_key_field->sql(m_key_value);
       strQuery += " WHERE \"" + get_table_name() + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->sql(primary_key_value);
-      const bool test = query_execute(strQuery, get_app_window());
+      const bool test = query_execute(strQuery);
       if(test)
       {
         //Show it on the view, if it's visible:

Modified: trunk/glom/mode_data/box_data_list_related.cc
==============================================================================
--- trunk/glom/mode_data/box_data_list_related.cc	(original)
+++ trunk/glom/mode_data/box_data_list_related.cc	Fri Jan 23 21:42:35 2009
@@ -280,7 +280,7 @@
       strQuery += " SET \"" +  /* get_table_name() + "." +*/ m_key_field->get_name() + "\" = " + m_key_field->sql(m_key_value);
       strQuery += " WHERE \"" + get_table_name() + "\".\"" + field_primary_key->get_name() + "\" = " + field_primary_key->sql(primary_key_value);
       std::cout << "Box_Data_List_Related::on_adddel_record_added(): setting value in db=" << primary_key_value.to_string() << std::endl;
-      const bool test = query_execute(strQuery, get_app_window());
+      const bool test = query_execute(strQuery);
       if(test)
       {
         //Show it on the view, if it's visible:

Modified: trunk/glom/mode_design/users/dialog_groups_list.cc
==============================================================================
--- trunk/glom/mode_design/users/dialog_groups_list.cc	(original)
+++ trunk/glom/mode_design/users/dialog_groups_list.cc	Fri Jan 23 21:42:35 2009
@@ -219,7 +219,7 @@
         if(response == Gtk::RESPONSE_OK)
         {
           Glib::ustring strQuery = "DROP GROUP \"" + group + "\"";
-          const bool test = query_execute(strQuery, this);
+          const bool test = query_execute(strQuery);
           if(!test)
             std::cerr << "Box_DB_Table_Definition::on_adddel_delete(): DROP GROUP failed." << std::endl;
 
@@ -259,7 +259,7 @@
   if(!group_name.empty())
   {
     const Glib::ustring strQuery = "CREATE GROUP \"" + group_name + "\"";
-    const bool test = query_execute(strQuery, this);
+    const bool test = query_execute(strQuery);
     if(!test)
       std::cout << "Dialog_GroupsList::on_button_group_new(): CREATE GROUP failed." << std::endl;
 
@@ -496,7 +496,7 @@
 
   strQuery += " GROUP \"" + group_name + "\"";
 
-  const bool test = query_execute(strQuery, this); //TODO: Handle errors.
+  const bool test = query_execute(strQuery); //TODO: Handle errors.
   if(!test)
     std::cerr << "Dialog_GroupsList::set_table_privilege(): GRANT/REVOKE failed." << std::endl;
 

Modified: trunk/glom/mode_design/users/dialog_users_list.cc
==============================================================================
--- trunk/glom/mode_design/users/dialog_users_list.cc	(original)
+++ trunk/glom/mode_design/users/dialog_users_list.cc	Fri Jan 23 21:42:35 2009
@@ -130,7 +130,7 @@
         if(!user.empty())
         {
           Glib::ustring strQuery = "ALTER GROUP \"" + m_combo_group->get_active_text() + "\" DROP USER \"" + user + "\"";
-          const bool test = query_execute(strQuery, this);
+          const bool test = query_execute(strQuery);
           if(!test)
             std::cerr << "Dialog_UsersList::on_button_user_remove(): ALTER GROUP failed." << std::endl;
 
@@ -169,7 +169,7 @@
           if(response == Gtk::RESPONSE_OK)
           {
             const Glib::ustring strQuery = "DROP USER \"" + user + "\"";
-            const bool test = query_execute(strQuery, this);
+            const bool test = query_execute(strQuery);
             if(!test)
               std::cerr << "Dialog_UsersList::on_button_user_delete(): DROP USER failed" << std::endl;
 
@@ -215,7 +215,7 @@
   {
     //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, this);
+    const bool test = query_execute(strQuery);
     if(!test)
       std::cerr << "Dialog_UsersList::on_button_user_add(): ALTER GROUP failed." << std::endl;
 
@@ -225,7 +225,7 @@
     for(Document_Glom::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, this);
+      const bool test = query_execute(strQuery);
       if(!test)
         std::cerr << "Dialog_UsersList::on_button_user_add(): REVOKE failed." << std::endl;
     }
@@ -281,13 +281,13 @@
   {
     //Create the user:
     Glib::ustring strQuery = "CREATE USER \"" + user + "\" PASSWORD '" + password + "'" ; //TODO: Escape the password.
-    bool test = query_execute(strQuery, this);
+    bool test = query_execute(strQuery);
     if(!test)
        std::cerr << "Dialog_UsersList::on_button_user_new(): CREATE USER failed." << std::endl;
 
     //Add it to the group:
     strQuery = "ALTER GROUP \"" + m_combo_group->get_active_text() + "\" ADD USER \"" + user + "\"";
-    test = query_execute(strQuery, this);
+    test = query_execute(strQuery);
     if(!test)
        std::cerr << "Dialog_UsersList::on_button_user_new(): ALTER GROUP failed." << std::endl;
 
@@ -365,7 +365,7 @@
       if(!user.empty() && !password.empty())
       {
         const Glib::ustring strQuery = "ALTER USER \"" + user + "\" PASSWORD '" + password + "'" ; //TODO: Escape the password.
-        const bool test = query_execute(strQuery, this);
+        const bool test = query_execute(strQuery);
         if(!test)
           std::cerr << "Dialog_UsersList::on_button_user_edit(): ALTER USER failed." << std::endl;
 

Modified: trunk/glom/navigation/box_tables.cc
==============================================================================
--- trunk/glom/navigation/box_tables.cc	(original)
+++ trunk/glom/navigation/box_tables.cc	Fri Jan 23 21:42:35 2009
@@ -301,7 +301,7 @@
           //Delete the table:
           if(iButtonClicked == Gtk::RESPONSE_OK)
           {
-            const bool test = query_execute( "DROP TABLE \"" + table_name + "\"", App_Glom::get_application());
+            const bool test = query_execute( "DROP TABLE \"" + table_name + "\"");
             if(!test)
               std::cerr << "Box_Tables::on_adddel_Delete(): DROP TABLE failed." << std::endl;
             else
@@ -436,7 +436,7 @@
         //Rename the table:
         if(iButtonClicked == Gtk::RESPONSE_OK)
         {
-          const bool test = query_execute( "ALTER TABLE \"" + table_name + "\" RENAME TO \"" + table_name_new + "\"", App_Glom::get_application());
+          const bool test = query_execute( "ALTER TABLE \"" + table_name + "\" RENAME TO \"" + table_name_new + "\"");
           if(test)
           {
             //Change the AddDel item's key:

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	Fri Jan 23 21:42:35 2009
@@ -275,7 +275,8 @@
           if(holder)
             m_db_values[i] = holder->get_value(); //TODO_gda: Why not just use get_value_at()?
           else
-            std::cerr << "DbTreeModelRow::fill_values_if_necessary(): NULL Gnome::Gda::Holder for field=" << i << std::endl;
+            // This is quite possible for example for unset dates, jhs 
+            ;//std::cerr << "DbTreeModelRow::fill_values_if_necessary(): NULL Gnome::Gda::Holder for field=" << i << std::endl;
 
           //std::cout << "  debug: col=" << i << ", GType=" << m_db_values[i].get_value_type() << std::endl;
         }



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