[glom/glom-1-20] SQLite: Avoid a warning about int types for summary fields.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] SQLite: Avoid a warning about int types for summary fields.
- Date: Tue, 29 Nov 2011 12:14:16 +0000 (UTC)
commit 3aec8c52f445ed98e952638d4a8a64b73dfc3ff9
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Nov 25 22:13:59 2011 +0100
SQLite: Avoid a warning about int types for summary fields.
* glom/libglom/data_structure/glomconversions.cc:
get_text_for_gda_value(): An int is normal for aggregate fields for
SQLite.
ChangeLog | 8 ++++++++
glom/libglom/data_structure/glomconversions.cc | 5 ++++-
glom/libglom/report_builder.cc | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7fc34b6..47bfb08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-11-25 Murray Cumming <murrayc murrayc com>
+ SQLite: Avoid a warning about int types for summary fields.
+
+ * glom/libglom/data_structure/glomconversions.cc:
+ get_text_for_gda_value(): An int is normal for aggregate fields for
+ SQLite.
+
+2011-11-25 Murray Cumming <murrayc murrayc com>
+
Avoid an uninteresting stdcerr warning.
* glom/libglom/connectionpool.cc: It is OK to not know
diff --git a/glom/libglom/data_structure/glomconversions.cc b/glom/libglom/data_structure/glomconversions.cc
index 62dcd26..de07d0e 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -420,7 +420,10 @@ Glib::ustring Conversions::get_text_for_gda_value(Field::glom_field_type glom_ty
}
else if(glom_type == Field::TYPE_NUMERIC)
{
- if(value.get_value_type() != GDA_TYPE_NUMERIC && value.get_value_type() != G_TYPE_DOUBLE)
+ const GType value_type = value.get_value_type();
+ if(value_type != GDA_TYPE_NUMERIC
+ && value_type != G_TYPE_DOUBLE
+ && value_type != G_TYPE_INT) //SQLite uses int for summary field results.
{
std::cerr << G_STRFUNC << ": glom field type is NUMERIC but GdaValue type is: " << g_type_name(value.get_value_type()) << std::endl;
return value.to_string();
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index 8caf696..07eb89a 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -418,7 +418,7 @@ void ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
if(text_value.empty() && sharedptr<const LayoutItem_FieldSummary>::cast_dynamic(field) && (field_type == Field::TYPE_NUMERIC))
{
//Use get_text_for_gda_value() instead of "0" so we get the correct numerical formatting:
- Gnome::Gda::Value value = Conversions::parse_value(0);
+ const Gnome::Gda::Value value = Conversions::parse_value(0);
text_value = Conversions::get_text_for_gda_value(field_type, value, field->get_formatting_used().m_numeric_format);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]