[libgdamm] SqlBuilder: Add SqlError and fix select_add_target() with no alias.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdamm] SqlBuilder: Add SqlError and fix select_add_target() with no alias.
- Date: Fri, 26 Feb 2010 23:58:24 +0000 (UTC)
commit 8af75c8b7f9efe1d373d6f31a449fe12d8b03134
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Feb 27 00:58:17 2010 +0100
SqlBuilder: Add SqlError and fix select_add_target() with no alias.
* libgda/src/sqlbuilder.[hg|ccg]: Add SqlError to wrap the GdaSqlError
error domain thrown (but not documented) by SqlBuilder.
select_add_target(): Avoid passing a alias. I have fixed the C
function in libgda but this makes it safe even when that is not deployed.
ChangeLog | 9 +++++++++
libgda/src/sqlbuilder.ccg | 11 ++++++++++-
libgda/src/sqlbuilder.hg | 3 ++-
3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a276f07..04013b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-27 Murray Cumming <murrayc murrayc com>
+
+ SqlBuilder: Add SqlError and fix select_add_target() with no alias.
+
+ * libgda/src/sqlbuilder.[hg|ccg]: Add SqlError to wrap the GdaSqlError
+ error domain thrown (but not documented) by SqlBuilder.
+ select_add_target(): Avoid passing a "" alias. I have fixed the C
+ function in libgda but this makes it safe even when that is not deployed.
+
3.99.19:
2010-02-25 Murray Cumming <murrayc murrayc com>
diff --git a/libgda/src/sqlbuilder.ccg b/libgda/src/sqlbuilder.ccg
index 6c4cbff..1a2c671 100644
--- a/libgda/src/sqlbuilder.ccg
+++ b/libgda/src/sqlbuilder.ccg
@@ -30,6 +30,15 @@ namespace Gnome
namespace Gda
{
+//TODO: Put this in glibmm and use it generally:
+static const char* string_or_null(const Glib::ustring& str)
+{
+ if(str.empty())
+ return 0; //Avoid returning "", because not all C functions check for it properly.
+ else
+ return str.c_str();
+}
+
SqlBuilder::SqlBuilder(SqlStatementType type)
: _CONSTRUCT("stmt-type", type)
{
@@ -73,7 +82,7 @@ guint SqlBuilder::add_function(const Glib::ustring& function_name, const Glib::A
guint SqlBuilder::select_add_target(const Glib::ustring& table_name, const Glib::ustring& alias)
{
- return gda_sql_builder_select_add_target(gobj(), table_name.c_str(), alias.c_str());
+ return gda_sql_builder_select_add_target(gobj(), table_name.c_str(), string_or_null(alias.c_str()));
}
diff --git a/libgda/src/sqlbuilder.hg b/libgda/src/sqlbuilder.hg
index f7bef2f..2c3dd83 100644
--- a/libgda/src/sqlbuilder.hg
+++ b/libgda/src/sqlbuilder.hg
@@ -33,6 +33,7 @@ namespace Gda
_WRAP_ENUM(SqlOperatorType, GdaSqlOperatorType)
_WRAP_ENUM(SqlSelectJoinType, GdaSqlSelectJoinType)
_WRAP_GERROR(SqlBuilderError, GdaSqlBuilderError, GDA_SQL_BUILDER_ERROR)
+_WRAP_GERROR(SqlError, GdaSqlErrorType, GDA_SQL_ERROR)
/*
* @ingroup Connection
@@ -152,7 +153,7 @@ public:
*/
guint select_add_target(const Glib::ustring& table_name, const Glib::ustring& alias = Glib::ustring());
- _IGNORE(gda_sql_builder_select_add_target_id)
+ _IGNORE(gda_sql_builder_select_add_target_id, gda_sql_builder_select_add_target)
/** Joins two targets in a SELECT statement
* @param left_target_id The ID of the left target to use (not %0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]