Commit 9a3cad4f authored by Murray Cumming's avatar Murray Cumming
Browse files

Increased version

parent e9d14299
0.8.35:
2005-07-18 Murray Cumming <murrayc@murrayc.com>
* glom/mode_data/box_data.cc: set_field_value_in_database():
Use the related table name if it is a related table.
add_related_record_for_field(): Added some warnings.
* glom/mode_data/box_data_details.cc:
get_primary_key_value_selected(): Actually return the field,
instead of a null field.
get_field_primary_key(): Return true instead of false, to
indicate success. This fixes automatic related-field setting.
* glom/utility_widgets/imageglom.cc:
2005-07-17 Murray Cumming <murrayc@murrayc.com>
* glom/mode_design/box_db_table_relationships.cc:
......
0.8.35:
* Tables: New tables have a description and a comments field as
well as the primary key.
* Details:
- Related fields, with automatic related-record creation:
Really write the new value into the related record, instead of
just creating the related record.
- The default layout is now more useful.
- Field titles are now visible again when there is only one
item in a multi-column group.
* Relationships: Create a suitable title when adding a
relationship name.
0.8.34:
* Prevented crash at startup. (Daniel Holbach)
......
......@@ -4,7 +4,7 @@ AC_INIT(glom/main.cc)
AM_CONFIG_HEADER(config.h)
# Package name and version number:
AM_INIT_AUTOMAKE(glom, 0.8.34)
AM_INIT_AUTOMAKE(glom, 0.8.35)
AM_MAINTAINER_MODE
......
......@@ -816,7 +816,22 @@ bool Box_Data::set_field_value_in_database(const Gtk::TreeModel::iterator& row,
const Glib::ustring field_name = field_layout.get_name();
if(!field_name.empty()) //This should not happen.
{
Glib::ustring strQuery = "UPDATE " + m_strTableName;
Glib::ustring table_name;
if(field_layout.get_has_relationship_name())
{
//The field is in a related table.
table_name = field_layout.m_relationship.get_to_table();
}
else
table_name = m_strTableName;
if(table_name.empty())
{
g_warning("Box_Data::set_field_value_in_database(): table_name is empty.");
return false;
}
Glib::ustring strQuery = "UPDATE " + table_name;
strQuery += " SET " + field_name + " = " + field.sql(field_value);
strQuery += " WHERE " + primary_key_field.get_name() + " = " + primary_key_field.sql(primary_key_value);
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = Query_execute(strQuery); //TODO: Handle errors
......@@ -1189,15 +1204,25 @@ bool Box_Data::add_related_record_for_field(const LayoutItem_Field& layout_item_
Field parent_primary_key_field;
bool test = get_field_primary_key(parent_primary_key_field);
if(!test)
{
g_warning("Box_Data::add_related_record_for_field(): get_field_primary_key() failed. table = %s", get_table_name().c_str());
return false;
}
else
{
const Gnome::Gda::Value parent_primary_key_value = get_primary_key_value_selected();
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);
bool test = Query_execute(strQuery);
return test;
if(parent_primary_key_value.is_null())
{
g_warning("Box_Data::add_related_record_for_field(): get_primary_key_value_selected() failed. table = %s", get_table_name().c_str());
return false;
}
else
{
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);
bool test = Query_execute(strQuery);
return test;
}
}
}
}
......
......@@ -344,16 +344,7 @@ void Box_Data_Details::set_entered_field_data(const LayoutItem_Field& field, con
Gnome::Gda::Value Box_Data_Details::get_primary_key_value_selected()
{
Glib::ustring strResult;
/* TODO_port.
guint uiRow = 0;
bool bPresent = get_field_primary_key(uiRow);
if(bPresent)
strResult = m_AddDel.get_value(uiRow);
*/
return Gnome::Gda::Value(strResult);
return m_primary_key_value;
}
/*
......@@ -547,6 +538,7 @@ void Box_Data_Details::on_flowtable_field_edited(const LayoutItem_Field& layout_
try
{
bool bTest = set_field_value_in_database(layout_field, field_value, primary_key_field, primary_key_value);
//Glib::ustring strQuery = "UPDATE " + table_name;
//strQuery += " SET " + /* table_name + "." + postgres does not seem to like the table name here */ strFieldName + " = " + field.sql(field_value);
//strQuery += " WHERE " + table_name + "." + primary_key_field.get_name() + " = " + primary_key_field.sql(primary_key_value);
......@@ -708,7 +700,7 @@ void Box_Data_Details::on_userlevel_changed(AppState::userlevels user_level)
bool Box_Data_Details::get_field_primary_key(Field& field) const
{
field = m_field_primary_key;
return false;
return true;
}
void Box_Data_Details::print_layout_group(xmlpp::Element* node_parent, const LayoutGroup& group)
......
......@@ -315,6 +315,12 @@ Glib::RefPtr<Gdk::Pixbuf> ImageGlom::scale_keeping_ratio(const Glib::RefPtr<Gdk:
target_height = (int)((float)pixbuf_height * ratio);
}
if( (target_height == 0) || (target_width == 0) )
{
g_warning("ImageGlom::scale_keeping_ratio(): calculated dimension is zero: target_width=%d, target_height=%d", target_width, target_height);
return Glib::RefPtr<Gdk::Pixbuf>(); //This shouldn't happen anyway.
}
return pixbuf->scale_simple(target_width, target_height, Gdk::INTERP_NEAREST);
}
......
......@@ -194,7 +194,7 @@ GlomUtils::type_list_values_with_second GlomUtils::get_choice_values(const Layou
sharedptr<SharedConnection> connection = ConnectionPool::get_instance()->connect();
std::cout << "get_choice_values: Executing SQL: " << sql_query << std::endl;
//std::cout << "get_choice_values: Executing SQL: " << sql_query << std::endl;
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = connection->get_gda_connection()->execute_single_command(sql_query);
if(datamodel)
......
......@@ -48,4 +48,6 @@ glom/utility_widgets/datawidget.cc
glom/utility_widgets/db_adddel/db_adddel.cc
glom/utility_widgets/entryglom.cc
glom/utility_widgets/flowtablewithfields.cc
glom/utility_widgets/imageglom.cc
glom/utility_widgets/layoutwidgetbase.cc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment