[glom/glom-1-18] build_simple_where_expression(): Check input parameters.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-18] build_simple_where_expression(): Check input parameters.
- Date: Fri, 7 Oct 2011 07:52:38 +0000 (UTC)
commit 9decb87fc7a5b8af8fbb4e247bb94d38b7ec5187
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Sep 29 11:24:17 2011 +0200
build_simple_where_expression(): Check input parameters.
* glom/libglom/utils.cc: build_simple_where_expression(): Check for an
empty key field, which can happen during debugging.
ChangeLog | 7 +++++++
glom/libglom/utils.cc | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 77b238e..5bc197c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-09-29 Murray Cumming <murrayc murrayc com>
+ build_simple_where_expression(): Check input parameters.
+
+ * glom/libglom/utils.cc: build_simple_where_expression(): Check for an
+ empty key field, which can happen during debugging.
+
+2011-09-29 Murray Cumming <murrayc murrayc com>
+
Glade utils: Catch generic exceptions.
* glom/glade_utils.h: Though this only happens when gtkmm has not been
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 4d5147f..2e69428 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -441,6 +441,12 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib
Gnome::Gda::SqlExpr Utils::build_simple_where_expression(const Glib::ustring& table_name, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& key_value)
{
+ if(!key_field)
+ {
+ std::cerr << G_STRFUNC << ": key_field was empty" << std::endl;
+ return Gnome::Gda::SqlExpr();
+ }
+
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_target(table_name); //This might not be necessary.
const Gnome::Gda::SqlBuilder::Id id = builder->add_cond(Gnome::Gda::SQL_OPERATOR_TYPE_EQ,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]