[tracker/wip/carlosg/statement-fixes: 1/7] libtracker-data: Add missing handling of G_TYPE_DATE_TIME




commit 499c5debefc867717fd8947ae3f4b258a579c57b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Nov 10 22:46:51 2021 +0200

    libtracker-data: Add missing handling of G_TYPE_DATE_TIME
    
    We cannot bind GDateTime to a statement directly, so handle it as a
    string.

 src/libtracker-data/tracker-db-interface-sqlite.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c 
b/src/libtracker-data/tracker-db-interface-sqlite.c
index c6a50add3..63305059f 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3375,6 +3375,14 @@ tracker_db_statement_bind_value (TrackerDBStatement *stmt,
                data = g_bytes_get_data (bytes, &len);
                sqlite3_bind_text (stmt->stmt, index + 1,
                                   data, len, SQLITE_TRANSIENT);
+       } else if (type == G_TYPE_DATE_TIME) {
+               GDateTime *datetime;
+               gchar *str;
+
+               datetime = g_value_get_boxed (value);
+               str = tracker_date_format_iso8601 (datetime);
+               sqlite3_bind_text (stmt->stmt, index + 1,
+                                  str, -1, g_free);
        } else {
                GValue dest = G_VALUE_INIT;
 


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