[tracker/wip/carlosg/serialize-api: 3/19] 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: 3/19] libtracker-data: Use SQL value type as a last resort to determine column type
- Date: Sun, 28 Nov 2021 13:32:05 +0000 (UTC)
commit e8e0d174e266f8c1d399a72f2fa73e95e26edea6
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 63305059f..a6456a647 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3596,7 +3596,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]