[glom] Use CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE.



commit abdcb5285de3a4f7dab71129406497879ee085ea
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 24 00:03:48 2009 +0200

    Use CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE.
    
    * glom/libglom/connectionpool_backends/postgres.cc:
    * glom/libglom/connectionpool_backends/sqlite.cc: When calling
    Gda::Connection::open_from_string(), use the new
    CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE option so the libgda
    API really does what we mean without needing any weird quoting.

 ChangeLog                                        |   10 ++++++++++
 glom/libglom/connectionpool_backends/postgres.cc |   20 +++++++++++++++-----
 glom/libglom/connectionpool_backends/sqlite.cc   |   16 ++++++++++++----
 3 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5926015..9e2c130 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-24  Murray Cumming  <murrayc murrayc com>
+
+	Use CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE.
+
+	* glom/libglom/connectionpool_backends/postgres.cc:
+	* glom/libglom/connectionpool_backends/sqlite.cc: When calling 
+	Gda::Connection::open_from_string(), use the new 
+	CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE option so the libgda 
+	API really does what we mean without needing any weird quoting.
+
 2009-07-23  Murray Cumming  <murrayc murrayc com>
 
 	Fix the build with Python 2.5, bringing back the warnings for others.
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index 86c105d..712af6d 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -81,10 +81,13 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
   std::cout << "  DEBUG: auth_string=" << auth_string << std::endl;
 #endif
 
+  //TODO: Use CONNECTION_OPTIONS_READ_ONLY in the client-only build:
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
-    connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
+    connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", 
+      cnc_string, auth_string, 
+      Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
     
     connection->statement_execute_non_select("SET DATESTYLE = 'ISO'");
     data_model = connection->statement_execute_select("SELECT version()");
@@ -93,7 +96,8 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
   {
 #else
   std::auto_ptr<Glib::Error> error;
-  connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+  connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", 
+    cnc_string, auth_string, Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE, error);
   
   if(!error)
     connection->statement_execute_non_select("SET DATESTYLE = 'ISO'", error);
@@ -117,10 +121,16 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-      temp_conn = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
-    } catch(const Glib::Error& ex) {}
+      temp_conn = Gnome::Gda::Connection::open_from_string("PostgreSQL", 
+        cnc_string, auth_string, 
+        Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
+    }
+    catch(const Glib::Error& ex)
+    {}
 #else
-    temp_conn = client->open_connection_from_string("PostgreSQL", cnc_string, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, glib_error);
+    temp_conn = client->open_connection_from_string("PostgreSQL", 
+      cnc_string, auth_string, 
+      Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE, glib_error);
 #endif
 
 #ifdef GLOM_CONNECTION_DEBUG
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 96e31f0..8798619 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -64,13 +64,17 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-      connection = Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, auth_string);
+      connection = Gnome::Gda::Connection::open_from_string("SQLite", 
+        cnc_string, auth_string,
+        CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
     }
     catch(const Glib::Error& ex)
     {
 #else
     std::auto_ptr<Glib::Error> error;
-    connection = Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, username, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+    connection = Gnome::Gda::Connection::open_from_string("SQLite", 
+      cnc_string, auth_string, 
+      CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE, error);
     if(error.get())
     {
       const Glib::Error& ex = *error.get();
@@ -101,7 +105,9 @@ bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ust
   try
   {
     Glib::RefPtr<Gnome::Gda::Connection> cnc = 
-      Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, "");
+      Gnome::Gda::Connection::open_from_string("SQLite", 
+        cnc_string, "",
+        CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
   }
   catch(const Glib::Error& ex)
   {
@@ -110,7 +116,9 @@ bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ust
   }
 #else
   Glib::RefPtr<Gnome::Gda::Connection> cnc = 
-    Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, "", Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+    Gnome::Gda::Connection::open_from_string("SQLite", 
+      cnc_string, "", 
+      CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE, error);
   if(error.get() != 0)
     return false
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]