From b0d33e95e22020efb156992a643cc40e7569a825 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <rishi@gnu.org>
Date: Sun, 22 Nov 2009 15:37:07 +0200
Subject: [PATCH] Ported to libgdamm-4.x

http://library.gnome.org/devel/libgda/stable/migration-2.html
---
 configure.ac                        |    4 +-
 src/application/main.cpp            |    2 +-
 src/attribute/exif-data.cpp         |    2 +-
 src/attribute/exif-data.h           |    2 +-
 src/attribute/modification-date.cpp |    2 +-
 src/attribute/modification-date.h   |    2 +-
 src/attribute/photo-tag.cpp         |    3 +-
 src/attribute/photo-tag.h           |    3 +-
 src/attribute/tag.cpp               |    2 +-
 src/attribute/tag.h                 |    3 +-
 src/attribute/thumbnail.cpp         |    2 +-
 src/attribute/thumbnail.h           |    2 +-
 src/common/photo.cpp                |    2 +-
 src/common/photo.h                  |    2 +-
 src/common/types.h                  |   11 +++++--
 src/database/database.cpp           |   51 ++++++++++++++++++++---------------
 src/database/database.h             |    5 +--
 src/database/db-object.cpp          |    3 +-
 src/database/db-object.h            |    3 +-
 src/database/db-table.cpp           |   48 ++++++++++++++++++--------------
 src/database/db-table.h             |   12 ++++----
 src/database/photo-tags-table.cpp   |    4 +-
 src/database/photos-table.cpp       |    4 +-
 src/database/tags-table.cpp         |    4 +-
 24 files changed, 99 insertions(+), 79 deletions(-)

diff --git a/configure.ac b/configure.ac
index f1a3385..11e4dbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,8 +25,8 @@ AM_PROG_LIBTOOL
 PKG_CHECK_MODULES(BABL, [babl])
 PKG_CHECK_MODULES(EXIV2, [exiv2 >= 0.18])
 PKG_CHECK_MODULES(FLICKCURL, [flickcurl])
-PKG_CHECK_MODULES(GDAMM, [libgdamm-3.0 <= 3.0.1])
-PKG_CHECK_MODULES(GDA_SQLITE, [libgda-sqlite-3.0])
+PKG_CHECK_MODULES(GDAMM, [libgdamm-4.0])
+PKG_CHECK_MODULES(GDA_SQLITE, [libgda-sqlite-4.0])
 PKG_CHECK_MODULES(GDL, [gdl-1.0])
 PKG_CHECK_MODULES(GEGL, [gegl])
 PKG_CHECK_MODULES(GPHOTO2, [libgphoto2])
diff --git a/src/application/main.cpp b/src/application/main.cpp
index 9afd635..44f4b45 100644
--- a/src/application/main.cpp
+++ b/src/application/main.cpp
@@ -46,7 +46,7 @@ main(int argc, char *argv[])
 
     Glib::thread_init();
     Gio::init();
-    Gnome::Gda::init(PACKAGE_NAME, PACKAGE_VERSION, argc, argv);
+    Gnome::Gda::init();
     gegl_init( &argc, &argv );
 
     if (0 != flickcurl_init())
diff --git a/src/attribute/exif-data.cpp b/src/attribute/exif-data.cpp
index 4b30866..b78d1f1 100644
--- a/src/attribute/exif-data.cpp
+++ b/src/attribute/exif-data.cpp
@@ -256,7 +256,7 @@ void ExifData::update( DataModelPtr &model, gint32 row)
 
 }
 
-void ExifData::create( DataModelPtr& dataModel, gint32 row)
+void ExifData::create(const DataModelPtr & dataModel, gint32 row)
 {
     aperture_ =  dataModel->get_value_at( 
                         APERTURE_COL, row ).get_string() ;
diff --git a/src/attribute/exif-data.h b/src/attribute/exif-data.h
index 12f593d..dc438d9 100644
--- a/src/attribute/exif-data.h
+++ b/src/attribute/exif-data.h
@@ -121,7 +121,7 @@ class ExifData
 
         void insert( std::vector<Gnome::Gda::Value> &values );
         void update( DataModelPtr &model, gint32 row );
-        void create( DataModelPtr &model, gint32 row );
+        void create(const DataModelPtr & model, gint32 row );
 
 };
 
diff --git a/src/attribute/modification-date.cpp b/src/attribute/modification-date.cpp
index 6e4fa91..5a4a95b 100644
--- a/src/attribute/modification-date.cpp
+++ b/src/attribute/modification-date.cpp
@@ -136,7 +136,7 @@ ModificationDate::update(
 }
 
 void
-ModificationDate::create(DataModelPtr & data_model, gint32 row)
+ModificationDate::create(const DataModelPtr & data_model, gint32 row)
 {
     set_day(
         data_model->get_value_at( MOD_DAY_COL, row ).get_int());    
diff --git a/src/attribute/modification-date.h b/src/attribute/modification-date.h
index 2e71dd1..569115c 100644
--- a/src/attribute/modification-date.h
+++ b/src/attribute/modification-date.h
@@ -168,7 +168,7 @@ class ModificationDate
         update(DataModelPtr & model, gint32 row) throw(Glib::Error);
 
         void
-        create(DataModelPtr & data_model, gint32 row);
+        create(const DataModelPtr & data_model, gint32 row);
 
 };    
 
diff --git a/src/attribute/photo-tag.cpp b/src/attribute/photo-tag.cpp
index 08d0d4c..014678e 100644
--- a/src/attribute/photo-tag.cpp
+++ b/src/attribute/photo-tag.cpp
@@ -88,7 +88,8 @@ PhotoTag::update(DataModelPtr & model, gint32 row) throw(Error)
 }
 
 void
-PhotoTag::create(DataModelPtr & dataModel, gint32 row) throw(Error)
+PhotoTag::create(const DataModelPtr & dataModel, gint32 row)
+                 throw(Error)
 {
     set_row( row );
     set_tagId_( dataModel->get_value_at( 
diff --git a/src/attribute/photo-tag.h b/src/attribute/photo-tag.h
index 0287943..329c2b2 100644
--- a/src/attribute/photo-tag.h
+++ b/src/attribute/photo-tag.h
@@ -66,7 +66,8 @@ class PhotoTag :
         update(DataModelPtr & model, gint32 row) throw(Error);
 
         virtual void
-        create(DataModelPtr & dataModel, gint32 row) throw(Error);
+        create(const DataModelPtr & dataModel, gint32 row)
+               throw(Error);
         
         virtual Glib::ustring
         get_db_object_type_name() const throw();
diff --git a/src/attribute/tag.cpp b/src/attribute/tag.cpp
index ffefab6..30c1201 100644
--- a/src/attribute/tag.cpp
+++ b/src/attribute/tag.cpp
@@ -114,7 +114,7 @@ Tag::update(DataModelPtr & model, gint32 row) throw(Error)
 }
 
 void
-Tag::create( DataModelPtr& dataModel, gint32 row) throw(Error)
+Tag::create(const DataModelPtr & dataModel, gint32 row) throw(Error)
 {
     set_row( row );
     set_tag_id( dataModel->get_value_at( 
diff --git a/src/attribute/tag.h b/src/attribute/tag.h
index 1d43dfa..f79461a 100644
--- a/src/attribute/tag.h
+++ b/src/attribute/tag.h
@@ -87,7 +87,8 @@ class Tag :
         update(DataModelPtr & model, gint32 row) throw(Error);
 
         virtual void
-        create(DataModelPtr & dataModel, gint32 row) throw(Error);
+        create(const DataModelPtr & dataModel, gint32 row)
+               throw(Error);
         
         virtual Glib::ustring
         get_db_object_type_name() const throw();
diff --git a/src/attribute/thumbnail.cpp b/src/attribute/thumbnail.cpp
index 7f0f3fa..c88f362 100644
--- a/src/attribute/thumbnail.cpp
+++ b/src/attribute/thumbnail.cpp
@@ -328,7 +328,7 @@ catch (Glib::Error & e)
 }
 
 void
-Thumbnail::create(DataModelPtr & dataModel, int32_t row)
+Thumbnail::create(const DataModelPtr & dataModel, int32_t row)
 {
     set_path( dataModel->get_value_at( 
                                     PATH_COL, row ).get_string());
diff --git a/src/attribute/thumbnail.h b/src/attribute/thumbnail.h
index 9cb512c..ad2c375 100644
--- a/src/attribute/thumbnail.h
+++ b/src/attribute/thumbnail.h
@@ -155,7 +155,7 @@ class Thumbnail
         update(DataModelPtr & model, gint32 row) throw(Glib::Error);
 
         void
-        create(DataModelPtr & data_model, gint32 row);
+        create(const DataModelPtr & data_model, gint32 row);
 
     private:
         void
diff --git a/src/common/photo.cpp b/src/common/photo.cpp
index 7ea61d1..ac4d3a7 100644
--- a/src/common/photo.cpp
+++ b/src/common/photo.cpp
@@ -161,7 +161,7 @@ catch(Glib::Error &e)
 }
 
 void
-Photo::create(DataModelPtr & dataModel, int32_t row) throw(Error)
+Photo::create(const DataModelPtr & dataModel, int32_t row) throw(Error)
 {
     set_row( row );
 
diff --git a/src/common/photo.h b/src/common/photo.h
index 99ddcc1..065188d 100644
--- a/src/common/photo.h
+++ b/src/common/photo.h
@@ -115,7 +115,7 @@ class Photo :
         update(DataModelPtr &model, gint32 row) throw(Error);
 
         virtual void
-        create( DataModelPtr& dataModel, gint32 row) throw(Error);
+        create(const DataModelPtr & dataModel, gint32 row) throw(Error);
         
         virtual Glib::ustring
         get_db_object_type_name() const throw();
diff --git a/src/common/types.h b/src/common/types.h
index 5026d7b..848ff0d 100644
--- a/src/common/types.h
+++ b/src/common/types.h
@@ -212,9 +212,14 @@ typedef Glib::RefPtr<Gio::DataInputStream> DataInputStreamPtr;
 typedef Glib::RefPtr<const Gio::File> ConstFilePtr;
 typedef Glib::RefPtr<Gio::File> FilePtr;
 
-typedef Glib::RefPtr<const Gnome::Gda::DataModelQuery>
-    ConstDataModelPtr;
-typedef Glib::RefPtr<Gnome::Gda::DataModelQuery> DataModelPtr;
+typedef Glib::RefPtr<const Gnome::Gda::Connection> ConstConnectionPtr;
+typedef Glib::RefPtr<Gnome::Gda::Connection> ConnectionPtr;
+
+typedef Glib::RefPtr<const Gnome::Gda::DataModel> ConstDataModelPtr;
+typedef Glib::RefPtr<Gnome::Gda::DataModel> DataModelPtr;
+
+typedef Glib::RefPtr<const Gnome::Gda::DataSelect> ConstDataSelectPtr;
+typedef Glib::RefPtr<Gnome::Gda::DataSelect> DataSelectPtr;
 
 typedef Glib::RefPtr<const Gtk::Action> ConstActionPtr;
 typedef Glib::RefPtr<Gtk::Action> ActionPtr;
diff --git a/src/database/database.cpp b/src/database/database.cpp
index bda5d89..967d40b 100644
--- a/src/database/database.cpp
+++ b/src/database/database.cpp
@@ -1,5 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
+ * Copyright (C) 2009 Debarshi Ray <rishi@gnu.org>
  * Copyright (C) 2009 Santanu Sinha <santanu.sinha@gmail.com>
  *
  * database.cpp is free software: you can redistribute it and/or modify it
@@ -86,18 +87,16 @@ Database::open() throw(Error)
     dbPath += ";DB_NAME=";
     dbPath += DB_NAME;
 
-    gdaClient_ = Gnome::Gda::Client::create();
     bool dbExists = db_file_exists();
-    gdaConnection_ = gdaClient_->open_connection_from_string(
-                                "SQLite", dbPath, "", "",
-                                Gnome::Gda::ConnectionOptions(0));
+    gdaConnection_ = Gnome::Gda::Connection::open_from_string(
+                         "SQLite", dbPath, "",
+                         Gnome::Gda::CONNECTION_OPTIONS_NONE);
     if( !dbExists )
     {
         create_db( );
     }
-    gdaDict_ = Gnome::Gda::Dict::create();
-    gdaDict_->set_connection( gdaConnection_ );
-    gdaDict_->update_dbms_meta_data();
+
+    gdaConnection_->update_meta_store();
     
     const char *tableNames[] = 
     {
@@ -110,7 +109,7 @@ Database::open() throw(Error)
     {
         DBTablePtr table = DBTableFactory::create( *tableName );
         tables_[ *tableName ] = table;
-        table->open( gdaDict_ );
+        table->open(gdaConnection_);
     }
 
 }
@@ -172,7 +171,8 @@ Database::run_sql( const Glib::ustring &sql ) throw(Error)
 {
     try
     {
-        gdaConnection_->execute_non_select_command( sql );
+        gdaConnection_->statement_execute(
+            sql, Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS);
     }
     catch(Glib::Error &error)
     {
@@ -249,13 +249,13 @@ Database::search(const PhotoSearchCriteriaList & criterion,
     PhotoList photos;
     try
     {
-        Glib::RefPtr<Gnome::Gda::Query> query 
-                                = Gnome::Gda::Query::create( gdaDict_ );
-        query->set_sql_text( sql );
-        Glib::RefPtr<Gnome::Gda::DataModelQuery> model 
-                            =  Gnome::Gda::DataModelQuery::create( query );
+        const DataModelPtr model
+            = gdaConnection_->statement_execute_select(
+                  sql, Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS);
+
+        const gint32 numRows
+                         = static_cast<gint32>(model->get_n_rows());
 
-        gint32 numRows = model->get_n_rows();
         observer->set_num_events( numRows );
         observer->set_event_description( "Generating list of photos" );
         DBTablePtr table = getTable( "photos" );
@@ -330,10 +330,13 @@ Database::get_dates_with_picture_count(
 
     try
     {
-        Glib::RefPtr<Gnome::Gda::DataModel> model
-                    = gdaConnection_->execute_select_command( sql );
+        const DataModelPtr model
+            = gdaConnection_->statement_execute_select(
+                  sql, Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS);
+
+        const gint32 numRows
+                         = static_cast<gint32>(model->get_n_rows());
 
-        gint32 numRows = model->get_n_rows();
         observer->set_num_events( numRows );
         observer->set_event_description(
                             "Generating summary of photos" );
@@ -402,7 +405,8 @@ Database::create_db() throw(Error)
                         white_balance varchar(100),\
                         focal_length_in_film varchar(100),\
                         picture_taken_time varchar(100))";
-            gdaConnection_->execute_non_select_command( sql );
+
+            gdaConnection_->statement_execute_non_select(sql);
         }
         //Tags
         {
@@ -411,14 +415,16 @@ Database::create_db() throw(Error)
                                 tag varchar(255),\
                                 description varchar(255),\
                                 iconpath varchar(255))";
-            gdaConnection_->execute_non_select_command( sql );
+
+            gdaConnection_->statement_execute_non_select(sql);
 
             //Create the all photos tag
             {
                 Glib::ustring sql = "INSERT INTO tags\
                                 values(0, 'All Photos', \
                                 'All photos imported in solang','')";
-                gdaConnection_->execute_non_select_command( sql );
+
+                gdaConnection_->statement_execute_non_select(sql);
             }
         }
         //Photo Tags
@@ -427,7 +433,8 @@ Database::create_db() throw(Error)
                                     photoid integer,\
                                     tagid integer,\
                                     primary key (photoid, tagid))";
-            gdaConnection_->execute_non_select_command( sql );
+
+            gdaConnection_->statement_execute_non_select(sql);
         }
     }
     catch (Glib::Error &e)
diff --git a/src/database/database.h b/src/database/database.h
index b4ae68c..adfa705 100644
--- a/src/database/database.h
+++ b/src/database/database.h
@@ -1,5 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
+ * Copyright (C) 2009 Debarshi Ray <rishi@gnu.org>
  * Copyright (C) 2009 Santanu Sinha <santanu.sinha@gmail.com>
  *
  * Solang is free software: you can redistribute it and/or modify it
@@ -38,9 +39,7 @@ class Database
     private:
         static const Glib::ustring DB_NAME;
         Glib::ustring path_; //Path to SQLLite database
-        Glib::RefPtr<Gnome::Gda::Client> gdaClient_;
-        Glib::RefPtr<Gnome::Gda::Connection> gdaConnection_;
-        Glib::RefPtr<Gnome::Gda::Dict> gdaDict_;
+        ConnectionPtr gdaConnection_;
         std::map<Glib::ustring, DBTablePtr> tables_;
 
     public:
diff --git a/src/database/db-object.cpp b/src/database/db-object.cpp
index 64ee065..259cd7e 100644
--- a/src/database/db-object.cpp
+++ b/src/database/db-object.cpp
@@ -68,8 +68,7 @@ DBObject::create(Database &db, gint32 row) throw(Error)
         set_table( table );
     }
     
-    Glib::RefPtr<Gnome::Gda::DataModelQuery> model 
-                                        = table->get_model();
+    const DataModelPtr model = table->get_model();
     create( model, row );
 
     return;
diff --git a/src/database/db-object.h b/src/database/db-object.h
index 7cbf930..343982f 100644
--- a/src/database/db-object.h
+++ b/src/database/db-object.h
@@ -78,7 +78,8 @@ class DBObject :
         //Construct object from a row in the 
         //given datamodel
         virtual void
-        create(DataModelPtr & dataModel, gint32 row) throw(Error) = 0;
+        create(const DataModelPtr & dataModel, gint32 row)
+               throw(Error) = 0;
         
         //Will be used by DB engine to construct the name
         //of tables in indices
diff --git a/src/database/db-table.cpp b/src/database/db-table.cpp
index 5f046dc..1345ba6 100644
--- a/src/database/db-table.cpp
+++ b/src/database/db-table.cpp
@@ -1,6 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * db-table.cpp
+ * Copyright (C) Debarshi Ray 2009 <rishi@gnu.org>
  * Copyright (C) Santanu Sinha 2009 <santanu.sinha@gmail.com>
  * 
  * db-table.cpp is free software: you can redistribute it and/or modify it
@@ -29,17 +30,15 @@ namespace Solang
 
 DBTable::DBTable( const Glib::ustring &tableName )
     :tableName_(tableName),
-    query_(),
     lastKey_(0),
-    model_()
+    gdaDataModel_()
 {
 }
 
 DBTable::DBTable( const DBTable &rhs )
     :tableName_( rhs.tableName_ ),
-    query_( rhs.query_ ),
     lastKey_( rhs.lastKey_ ),
-    model_( rhs.model_ )
+    gdaDataModel_( rhs.gdaDataModel_ )
 {
 }
 
@@ -48,36 +47,43 @@ DBTable &DBTable::operator = (const DBTable &rhs)
     if( this != &rhs )
     {
         tableName_ =  rhs.tableName_ ;
-        query_ = rhs.query_ ;
-        model_ = rhs.model_ ;
         lastKey_ = rhs.lastKey_ ;
+        gdaDataModel_ = rhs.gdaDataModel_ ;
     }    
     return *this;
 }
 
-void DBTable::open( 
-            const Glib::RefPtr<Gnome::Gda::Dict> &gdaDict) throw(Error)
+void DBTable::open(const ConnectionPtr & connection) throw(Error)
 {
-    query_ = Gnome::Gda::Query::create( gdaDict );
-    query_->set_sql_text( getSelectionQuery() );
-    model_ = Gnome::Gda::DataModelQuery::create( query_ );
+    gdaDataModel_
+        = connection->statement_execute_select(
+              getSelectionQuery(),
+              Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS);
+
+    const DataSelectPtr data_select = Glib::RefPtr<
+        Gnome::Gda::DataSelect>::cast_dynamic(gdaDataModel_);
+
     try
     {
 #if 0
-        model_->set_modification_query( getInsertQuery() );
-        model_->set_modification_query( getUpdateQuery() );
-        model_->set_modification_query( getDeleteQuery() );
+        data_select->set_modification_query( getInsertQuery() );
+        data_select->set_modification_query( getUpdateQuery() );
+        data_select->set_modification_query( getDeleteQuery() );
 #endif
-        model_->compute_modification_queries( tableName_, 
-                    Gnome::Gda::DATA_MODEL_QUERY_OPTION_USE_ALL_FIELDS_IF_NO_PK ); 
+        data_select->compute_modification_statements();
     }
     catch( const Glib::Error &error )
     {
         //TBD::Error
         std::cerr<<"Error:"<<tableName_<<": "<<error.what()<<std::endl;
     }
-    gint32 numRows = model_->get_n_rows();
-    lastKey_ = ( numRows ) ? (model_->get_value_at( 0, numRows -1 ).get_int()) : 0;
+
+    const gint32 numRows
+        = static_cast<gint32>(gdaDataModel_->get_n_rows());
+
+    lastKey_ = ( numRows ) ? (gdaDataModel_->get_value_at(
+                                 0, numRows -1 ).get_int())
+                           : 0;
     return;
     
 }
@@ -86,7 +92,7 @@ void DBTable::insert( DBObject &object )
 {
     try
     {
-        object.insert( model_, lastKey_ );
+        object.insert( gdaDataModel_, lastKey_ );
     }
     catch( Error &error )
     {
@@ -101,7 +107,7 @@ void DBTable::update( DBObject &object )
 {
     try
     {
-        object.update( model_ );
+        object.update( gdaDataModel_ );
     }
     catch( Error &error )
     {
@@ -115,7 +121,7 @@ void DBTable::remove( DBObject &object )
 {
     try
     {
-        object.remove( model_ );
+        object.remove( gdaDataModel_ );
     }
     catch( Error &error )
     {
diff --git a/src/database/db-table.h b/src/database/db-table.h
index 659fdde..f9ecada 100644
--- a/src/database/db-table.h
+++ b/src/database/db-table.h
@@ -1,6 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * db-table.h
+ * Copyright (C) Debarshi Ray 2009 <rishi@gnu.org>
  * Copyright (C) Santanu Sinha 2009 <santanu.sinha@gmail.com>
  * 
  * d-b-table.h is free software: you can redistribute it and/or modify it
@@ -36,11 +37,10 @@ class DBTable
     private:
         static const gint32 PRIMARY_KEY_COL;
         Glib::ustring tableName_;
-        Glib::RefPtr<Gnome::Gda::Query> query_;
         gint32 lastKey_;
 
     protected:
-        Glib::RefPtr<Gnome::Gda::DataModelQuery> model_;
+        DataModelPtr gdaDataModel_;
 
     public:
         DBTable( const Glib::ustring &tableName );
@@ -50,9 +50,9 @@ class DBTable
         {
         }
 
-        void open(
-                const Glib::RefPtr<Gnome::Gda::Dict> &gdaDict
-                                                ) throw(Error);
+        void
+        open(const ConnectionPtr & connection) throw(Error);
+
         virtual void receive( DBTableVisitor &visitor, 
                         ProgressObserverPtr &progressObserver ) = 0;  
             //to extract recordset of leaf level database objects
@@ -68,7 +68,7 @@ class DBTable
         inline const DataModelPtr &
         get_model()
         {
-            return model_;
+            return gdaDataModel_;
         }
         
 };
diff --git a/src/database/photo-tags-table.cpp b/src/database/photo-tags-table.cpp
index 0546092..bd67eb6 100644
--- a/src/database/photo-tags-table.cpp
+++ b/src/database/photo-tags-table.cpp
@@ -68,7 +68,7 @@ Glib::ustring PhotoTagsTable::getDeleteQuery() const
 void PhotoTagsTable::receive(Solang::DBTableVisitor& visitor, 
                         Solang::ProgressObserverPtr &observer)
 {
-    gint32 numRows = model_->get_n_rows();
+    gint32 numRows = gdaDataModel_->get_n_rows();
     observer->set_num_events( numRows );
     observer->set_event_description( 
                 "Generating list of photo-tag associations" );
@@ -80,7 +80,7 @@ void PhotoTagsTable::receive(Solang::DBTableVisitor& visitor,
         if( !observer->get_stop() )
         {
             TagPtr tag( new Tag() );
-            tag->create( model_, row );
+            tag->create( gdaDataModel_, row );
             tags.push_back( tag );
             observer->receive_event_notifiation();
         }
diff --git a/src/database/photos-table.cpp b/src/database/photos-table.cpp
index 10efa7a..4a2ae3e 100644
--- a/src/database/photos-table.cpp
+++ b/src/database/photos-table.cpp
@@ -70,7 +70,7 @@ void
 PhotosTable::receive(Solang::DBTableVisitor & visitor, 
                      Solang::ProgressObserverPtr & observer)
 {
-    gint32 numRows = model_->get_n_rows();
+    gint32 numRows = gdaDataModel_->get_n_rows();
     observer->set_num_events(numRows);
     observer->set_event_description("Generating list of photos");
 
@@ -81,7 +81,7 @@ PhotosTable::receive(Solang::DBTableVisitor & visitor,
         if( !observer->get_stop() )
         {
             PhotoPtr photo( new Photo() );
-            photo->create( model_, row );
+            photo->create( gdaDataModel_, row );
             photos.push_back( photo );
             observer->receive_event_notifiation();
         }
diff --git a/src/database/tags-table.cpp b/src/database/tags-table.cpp
index 57e4e19..afda613 100644
--- a/src/database/tags-table.cpp
+++ b/src/database/tags-table.cpp
@@ -79,7 +79,7 @@ void
 TagsTable::receive(Solang::DBTableVisitor& visitor,
                    Solang::ProgressObserverPtr &observer)
 {
-    gint32 numRows = model_->get_n_rows();
+    gint32 numRows = gdaDataModel_->get_n_rows();
     observer->set_num_events( numRows );
     observer->set_event_description( "Generating list of tags" );
 
@@ -90,7 +90,7 @@ TagsTable::receive(Solang::DBTableVisitor& visitor,
         if( !observer->get_stop() )
         {
             TagPtr tag( new Tag() );
-            tag->create( model_, row );
+            tag->create( gdaDataModel_, row );
             tags.push_back( tag );
             observer->receive_event_notifiation();
         }
-- 
1.6.2.5

