[glom] Some checks for GValues with invalid types.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Some checks for GValues with invalid types.
- Date: Tue, 20 Sep 2011 21:07:31 +0000 (UTC)
commit a825241676429519d16401a8e639d7bc127b87bc
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 20 22:13:19 2011 +0200
Some checks for GValues with invalid types.
* glom/libglom/data_structure/glomconversions.cc: value_is_empty():
Also check for a 0 GType, which now (in libgda-5.0) means invalid, not
SQL-null.
* glom/mode_data/box_data_details.cc:
set_found_set_from_primary_key_value(): Use value_is_empty() instead of
checking for a null value.
ChangeLog | 11 +++++++++++
glom/libglom/data_structure/glomconversions.cc | 4 +++-
glom/mode_data/box_data_details.cc | 4 ++--
3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a22246b..3138015 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2011-09-20 Murray Cumming <murrayc murrayc com>
+ Some checks for GValues with invalid types.
+
+ * glom/libglom/data_structure/glomconversions.cc: value_is_empty():
+ Also check for a 0 GType, which now (in libgda-5.0) means invalid, not
+ SQL-null.
+ * glom/mode_data/box_data_details.cc:
+ set_found_set_from_primary_key_value(): Use value_is_empty() instead of
+ checking for a null value.
+
+2011-09-20 Murray Cumming <murrayc murrayc com>
+
Print Layout: Layout: Fix alignment/expansion of the line options.
* ui/developer/window_data_layout.glade: Remove some horizontal expand=true.
diff --git a/glom/libglom/data_structure/glomconversions.cc b/glom/libglom/data_structure/glomconversions.cc
index d70bc0d..20d18e0 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -905,10 +905,12 @@ bool Conversions::value_is_empty(const Gnome::Gda::Value& value)
switch(value.get_value_type())
{
+ case(0):
+ return true; //Empty and invalid. It has not been initalized with a type.
case(G_TYPE_STRING):
return value.get_string().empty();
default:
- return false; //None of the other types can be empty. (An empty numeric, date, or time type shows up as a NULL).
+ return false; //None of the other types can be empty. (An empty numeric, date, or time type shows up as a GDA_TYPE_NULL).
}
}
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index aba39e2..9897c64 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -164,7 +164,7 @@ void Box_Data_Details::set_found_set_from_primary_key_value()
if(!m_field_primary_key)
return;
- if(!m_primary_key_value.is_null())
+ if(!Conversions::value_is_empty(m_primary_key_value))
{
m_found_set.m_where_clause = Utils::build_simple_where_expression(
m_table_name, m_field_primary_key, m_primary_key_value);
@@ -984,7 +984,7 @@ void Box_Data_Details::print_layout()
//The groups:
xmlpp::Element* nodeParent = nodeRoot;
- Document::type_list_layout_groups layout_groups = get_data_layout_groups(m_layout_name, m_layout_platform);
+ const Document::type_list_layout_groups layout_groups = get_data_layout_groups(m_layout_name, m_layout_platform);
for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != layout_groups.end(); ++iter)
{
sharedptr<const LayoutGroup> layout_group = *iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]