[libgdamm] Fix per-table meta-store retrieval for table names with capital letters.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [libgdamm] Fix per-table meta-store retrieval for table names with capital letters.
- Date: Wed, 1 Jul 2009 08:18:25 +0000 (UTC)
commit 6c01994de5e4dd6dbe04ef6eb479482185664bdb
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jun 30 19:09:33 2009 +0200
Fix per-table meta-store retrieval for table names with capital letters.
* libgda/src/connection.ccg: update_meta_store_table():
Quote the table name so it works with capital letters, spaces, etc.
Vivien Malerba stated on the mailing list that this is necessary.
I am not convinced that this function works at all anyway though.
ChangeLog | 9 +++++++++
libgda/src/connection.ccg | 11 +++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6173795..d574fc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-06-30 Murray Cumming <murrayc murrayc com>
+
+ Fix per-table meta-store retrieval for table names with capital letters.
+
+ * libgda/src/connection.ccg: update_meta_store_table():
+ Quote the table name so it works with capital letters, spaces, etc.
+ Vivien Malerba stated on the mailing list that this is necessary.
+ I am not convinced that this function works at all anyway though.
+
3.99.16:
2009-06-29 Johannes Schmid <jschmid openismus com>
diff --git a/libgda/src/connection.ccg b/libgda/src/connection.ccg
index 1bf50a6..21f930a 100644
--- a/libgda/src/connection.ccg
+++ b/libgda/src/connection.ccg
@@ -24,6 +24,7 @@
#include <libgdamm/metastore.h>
#include <libgda/gda-enum-types.h>
#include <libgda/gda-connection.h>
+#include <sql-parser/gda-sql-parser.h> //For gda_sql_identifier_add_quotes().
#include <libgda/libgda.h> //For GDA_GENERAL_ERROR
#include <iostream>
@@ -369,9 +370,12 @@ bool Connection::update_meta_store_table(const Glib::ustring& table_name, const
bool Connection::update_meta_store_table(const Glib::ustring& table_name, const Glib::ustring& schema_name, std::auto_ptr<Glib::Error>& error)
#endif
{
+ gchar* table_name_quoted = gda_sql_identifier_add_quotes(table_name.c_str());
+ std::cout << "Connection::update_meta_store_table(): table_name_quoted=" << table_name_quoted << std::endl;
+
GValue table_name_value = { 0 };
g_value_init(&table_name_value, G_TYPE_STRING);
- g_value_set_static_string(&table_name_value, table_name.c_str());
+ g_value_set_static_string(&table_name_value, table_name_quoted);
GValue table_schema_value = { 0 };
g_value_init(&table_schema_value, G_TYPE_STRING);
@@ -383,10 +387,13 @@ bool Connection::update_meta_store_table(const Glib::ustring& table_name, const
GdaMetaContext mcontext = {(gchar*)"_tables", schema_name.empty() ? 1 : 2, column_names, column_values };
GError* gerror = 0;
const bool retval = gda_connection_update_meta_store(gobj(), &mcontext, &gerror);
+ std::cout << " retval=" << retval << std::endl;
g_value_unset(&table_name_value);
g_value_unset(&table_schema_value);
+ g_free(table_name_quoted);
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
@@ -394,7 +401,7 @@ bool Connection::update_meta_store_table(const Glib::ustring& table_name, const
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
-
+
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]