[tracker/wip/carlosg/shuffle-nao: 3/4] libtracker-fts: Be lenient to non-existing fts tables when deleting them



commit d7401d0319ff5b557be1e6878d29402622f8cfd2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 10 13:28:49 2020 +0200

    libtracker-fts: Be lenient to non-existing fts tables when deleting them
    
    A funny thing of moving the nao ontology is that we no longer define FTS
    properties in the core protocol, so it may be the case that simple ontologies
    built on top won't have that table de-facto anymore.
    
    This triggers errors on our ontology change tests, which does attempt to
    define FTS properties in an ontology update. This now fails because the
    tables weren't created in the first place, so attempting to drop and
    rebuild those fails on the first step.

 src/libtracker-fts/tracker-fts.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-fts/tracker-fts.c b/src/libtracker-fts/tracker-fts.c
index 15743b00e..e470be4fe 100644
--- a/src/libtracker-fts/tracker-fts.c
+++ b/src/libtracker-fts/tracker-fts.c
@@ -177,14 +177,14 @@ tracker_fts_delete_table (sqlite3     *db,
        gchar *query;
        int rc;
 
-       query = g_strdup_printf ("DROP VIEW fts_view");
+       query = g_strdup_printf ("DROP VIEW IF EXISTS fts_view");
        rc = sqlite3_exec (db, query, NULL, NULL, NULL);
        g_free (query);
 
        if (rc == SQLITE_OK) {
-               query = g_strdup_printf ("DROP TABLE \"%s\".%s",
+               query = g_strdup_printf ("DROP TABLE IF EXISTS \"%s\".%s",
                                         database, table_name);
-               sqlite3_exec (db, query, NULL, NULL, NULL);
+               rc = sqlite3_exec (db, query, NULL, NULL, NULL);
                g_free (query);
        }
 


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