382
* cd_mapping_db_sqlite_timestamp_cb:
385
cd_mapping_db_sqlite_timestamp_cb (void *data,
390
guint64 *timestamp = (guint64 *) data;
392
/* should only be one entry */
393
g_debug ("CdMappingDb: got sql entry %s", argv[0]);
394
*timestamp = g_ascii_strtoull (argv[0], NULL, 10);
399
* cd_mapping_db_get_timestamp:
401
* Gets when the profile was added to the device.
404
cd_mapping_db_get_timestamp (CdMappingDb *mdb,
405
const gchar *device_id,
406
const gchar *profile_id,
409
gchar *error_msg = NULL;
412
guint64 timestamp = G_MAXUINT64;
414
g_return_val_if_fail (CD_IS_MAPPING_DB (mdb), FALSE);
415
g_return_val_if_fail (mdb->priv->db != NULL, FALSE);
417
g_debug ("CdMappingDb: get checksum for %s<->%s",
418
device_id, profile_id);
419
statement = g_strdup_printf ("SELECT timestamp FROM mappings WHERE "
420
"device = '%s' AND profile = '%s' "
421
"LIMIT 1;", device_id, profile_id);
423
/* query the checksum */
424
rc = sqlite3_exec (mdb->priv->db,
426
cd_mapping_db_sqlite_timestamp_cb,
429
if (rc != SQLITE_OK) {
432
CD_MAIN_ERROR_FAILED,
435
sqlite3_free (error_msg);
382
444
* cd_mapping_db_class_init:
383
445
* @klass: The CdMappingDbClass