[nautilus] batch-rename-utilities: fix query limit error



commit be2dd9b8e6060691a7cc425a6209fe0d6088b579
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Tue Sep 6 00:04:23 2016 +0300

    batch-rename-utilities: fix query limit error
    
    If there were too many files in batch renaming, the tracker query would
    give the following error: "parser stack overflow", because the limit for
    the expression tree depth was hit for the file name filter.
    
    The fix was to use a filter that doesn't expand that much in sql.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770586

 src/nautilus-batch-rename-utilities.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c
index 1131dc1..a0a9ce1 100644
--- a/src/nautilus-batch-rename-utilities.c
+++ b/src/nautilus-batch-rename-utilities.c
@@ -1103,13 +1103,19 @@ check_metadata_for_selection (NautilusBatchRenameDialog *dialog,
         if (l == selection)
         {
             g_string_append_printf (query,
-                                    "FILTER (nfo:fileName(?file) = '%s' ",
+                                    "FILTER (nfo:fileName(?file) IN ('%s', ",
+                                    file_name);
+        }
+        else if (l->next == NULL)
+        {
+            g_string_append_printf (query,
+                                    "'%s')) ",
                                     file_name);
         }
         else
         {
             g_string_append_printf (query,
-                                    "|| nfo:fileName(?file) = '%s' ",
+                                    "'%s', ",
                                     file_name);
         }
 
@@ -1129,7 +1135,7 @@ check_metadata_for_selection (NautilusBatchRenameDialog *dialog,
         g_free (file_name);
     }
 
-    g_string_append (query, ")} ORDER BY ASC(nie:contentCreated(?file))");
+    g_string_append (query, "} ORDER BY ASC(nie:contentCreated(?file))");
 
     connection = tracker_sparql_connection_get (NULL, &error);
     if (!connection)


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