[tracker/wip/carlosg/serialize-api: 10/26] libtracker-data: Use SQL value type as a last resort to determine column type
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/serialize-api: 10/26] libtracker-data: Use SQL value type as a last resort to determine column type
- Date: Sun, 19 Dec 2021 10:35:01 +0000 (UTC)
commit 6ee7fc36a1665579f8e13560123da4315528b46b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Nov 21 11:34:53 2021 +0100
libtracker-data: Use SQL value type as a last resort to determine column type
Since all values in SQLite are neatly transformable to strings, we resorted
to those if we could not know the underlying type. Look up the SQLite value
type for that column as a last resort, so we have better chances of getting
it right.
src/libtracker-data/tracker-db-interface-sqlite.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index b73d10b3a..4978b9b55 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3607,7 +3607,14 @@ tracker_db_cursor_get_value_type (TrackerDBCursor *cursor,
}
}
- return TRACKER_SPARQL_VALUE_TYPE_STRING;
+ switch (column_type) {
+ case SQLITE_INTEGER:
+ return TRACKER_SPARQL_VALUE_TYPE_INTEGER;
+ case SQLITE_FLOAT:
+ return TRACKER_SPARQL_VALUE_TYPE_DOUBLE;
+ default:
+ return TRACKER_SPARQL_VALUE_TYPE_STRING;
+ }
}
const gchar*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]