[glom] Backends: Slight reorganization.



commit fe555b87118888533334c6fa2c11ff87bba13b55
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jul 4 15:00:54 2011 +0200

    Backends: Slight reorganization.
    
    * glom/libglom/connectionpool_backends/backend.h:
    * glom/libglom/connectionpool_backends/postgres.[h|cc]:
    * glom/libglom/connectionpool_backends/sqlite.[h|cc]: Move method
      implementations into the .cc files.

 ChangeLog                                        |    9 +++++++++
 glom/libglom/connectionpool_backends/backend.h   |    6 ++----
 glom/libglom/connectionpool_backends/postgres.cc |   22 ++++++++++++++++++++++
 glom/libglom/connectionpool_backends/postgres.h  |    8 ++++----
 glom/libglom/connectionpool_backends/sqlite.cc   |   19 +++++++++++++++++++
 glom/libglom/connectionpool_backends/sqlite.h    |    8 ++++----
 6 files changed, 60 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d654c9c..5ff21b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-07-04  Murray Cumming  <murrayc murrayc com>
+
+	Backends: Slight reorganization.
+
+	* glom/libglom/connectionpool_backends/backend.h:
+	* glom/libglom/connectionpool_backends/postgres.[h|cc]:
+	* glom/libglom/connectionpool_backends/sqlite.[h|cc]: Move method 
+  implementations into the .cc files.
+
 2011-06-23  Murray Cumming  <murrayc murrayc com>
 
 	Field::sql_find(): Do not quote the string.
diff --git a/glom/libglom/connectionpool_backends/backend.h b/glom/libglom/connectionpool_backends/backend.h
index 5ef1421..787a2c9 100644
--- a/glom/libglom/connectionpool_backends/backend.h
+++ b/glom/libglom/connectionpool_backends/backend.h
@@ -99,11 +99,9 @@ protected:
    */
   virtual bool supports_remote_access() const = 0;
 
-  /** The operator to use to compare strings in a case-independant way. This
-   * is backend-depandent. For example, postgres uses ILIKE but SQLite uses
+  /** The operator to use to compare strings in a case-insensitive way. This
+   * is backend-dependent. For example, postgres uses ILIKE but SQLite uses
    * LIKE.
-   * TODO: Maybe we can use libgda to construct the expression, so we don't
-   * need this function.
    */
   virtual Gnome::Gda::SqlOperatorType get_string_find_operator() const = 0;
 
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index 957fd65..e7e0669 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -887,6 +887,28 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
   return true; //Success.
 }
 
+Field::sql_format Postgres::get_sql_format() const
+{
+  return Field::SQL_FORMAT_POSTGRES;
+}
+
+bool Postgres::supports_remote_access() const
+{
+  return true;
+}
+
+Gnome::Gda::SqlOperatorType Postgres::get_string_find_operator() const
+{
+  // TODO: ILIKE is a PostgreSQL extension for locale-dependent case-insensitive matches.
+  //See http://developer.postgresql.org/pgdocs/postgres/functions-matching.html
+  return Gnome::Gda::SQL_OPERATOR_TYPE_LIKE;
+}
+
+const char* Postgres::get_public_schema_name() const
+{
+  return "public";
+}
+
 } //namespace ConnectionPoolBackends
 
 } //namespace Glom
diff --git a/glom/libglom/connectionpool_backends/postgres.h b/glom/libglom/connectionpool_backends/postgres.h
index a947770..5432ad1 100644
--- a/glom/libglom/connectionpool_backends/postgres.h
+++ b/glom/libglom/connectionpool_backends/postgres.h
@@ -56,10 +56,10 @@ public:
 
 
 private:
-  virtual Field::sql_format get_sql_format() const { return Field::SQL_FORMAT_POSTGRES; }
-  virtual bool supports_remote_access() const { return true; }
-  virtual Gnome::Gda::SqlOperatorType get_string_find_operator() const { return Gnome::Gda::SQL_OPERATOR_TYPE_LIKE;  } //TODO: Use ILIKE ILIKE is a postgres extension for locale-dependent case-insensitive matches.
-  virtual const char* get_public_schema_name() const { return "public"; }
+  virtual Field::sql_format get_sql_format() const;
+  virtual bool supports_remote_access() const;
+  virtual Gnome::Gda::SqlOperatorType get_string_find_operator() const;
+  virtual const char* get_public_schema_name() const;
 
   virtual bool change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields) throw();
 
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index ff9cf90..998f8c4 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -390,6 +390,25 @@ bool Sqlite::convert_backup(const SlotProgress& /* slot_progress */, const std::
   return false;
 }
 
+Field::sql_format Sqlite::get_sql_format() const
+{
+  return Field::SQL_FORMAT_SQLITE;
+}
+
+bool Sqlite::supports_remote_access() const
+{
+  return false;
+}
+
+Gnome::Gda::SqlOperatorType Sqlite::get_string_find_operator() const
+{
+  return Gnome::Gda::SQL_OPERATOR_TYPE_LIKE;
+}
+
+const char* Sqlite::get_public_schema_name() const
+{
+  return "main";
+}
 
 } // namespace ConnectionPoolBackends
 
diff --git a/glom/libglom/connectionpool_backends/sqlite.h b/glom/libglom/connectionpool_backends/sqlite.h
index b963c23..b5a322c 100644
--- a/glom/libglom/connectionpool_backends/sqlite.h
+++ b/glom/libglom/connectionpool_backends/sqlite.h
@@ -38,10 +38,10 @@ public:
   Sqlite();
 
 private:
-  virtual Field::sql_format get_sql_format() const { return Field::SQL_FORMAT_SQLITE; }
-  virtual bool supports_remote_access() const { return false; }
-  virtual Gnome::Gda::SqlOperatorType get_string_find_operator() const { return Gnome::Gda::SQL_OPERATOR_TYPE_LIKE; }
-  virtual const char* get_public_schema_name() const { return "main"; }
+  virtual Field::sql_format get_sql_format() const;
+  virtual bool supports_remote_access() const;
+  virtual Gnome::Gda::SqlOperatorType get_string_find_operator() const;
+  virtual const char* get_public_schema_name() const;
 
   bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, GdaMetaTableColumn* column, unsigned int i);
   bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, const sharedptr<const Field>& column, unsigned int i);



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