[gnome-photos/wip/foo: 6/13] query-builder: Add photos_query_builder_update_mtime_query



commit cc363490573a5444d89b46a2729c06b93cedad8e
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Mar 30 00:14:15 2013 +0100

    query-builder: Add photos_query_builder_update_mtime_query

 src/photos-query-builder.c |   20 ++++++++++++++++++++
 src/photos-query-builder.h |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index b0586f7..67da6a3 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -268,6 +268,26 @@ photos_query_builder_single_query (gint flags, const gchar *resource)
 }
 
 
+PhotosQuery *
+photos_query_builder_update_mtime_query (const gchar *resource)
+{
+  GTimeVal tv;
+  gchar *sparql;
+  gchar *time;
+  gint64 timestamp;
+
+  timestamp = g_get_real_time () / G_USEC_PER_SEC;
+  tv.tv_sec = timestamp;
+  tv.tv_usec = 0;
+  time = g_time_val_to_iso8601 (&tv);
+
+  sparql = g_strdup_printf ("INSERT OR REPLACE { <%s> nie:contentLastModified \"%s\" }", resource, time);
+  g_free (time);
+
+  return photos_query_new (sparql);
+}
+
+
 gchar *
 photos_query_builder_filter_local (void)
 {
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index e92ff24..fb96505 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -43,6 +43,8 @@ PhotosQuery  *photos_query_builder_global_query        (void);
 
 PhotosQuery  *photos_query_builder_single_query        (gint flags, const gchar *resource);
 
+PhotosQuery  *photos_query_builder_update_mtime_query (const gchar *resource);
+
 gchar        *photos_query_builder_filter_local        (void);
 
 G_END_DECLS


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