From: Lokesh Date: Mon, 12 Aug 2019 10:23:53 +0000 (+0530) Subject: Fix to store only required bytes of BLE payload into DB X-Git-Tag: accepted/tizen/unified/20190819.112109~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef737aa7311f96d400218e7deecbbeac789d9384;p=platform%2Fcore%2Fconnectivity%2Fua-manager.git Fix to store only required bytes of BLE payload into DB Put number of bytes to be stored instead of '-1'. As -1 continues untill a NULL character is encountered. Change-Id: Iec025a35f8e610a92c9ae5ef39412bf450d6f524 Signed-off-by: Lokesh --- diff --git a/ua-daemon/src/ua-manager-device-db.c b/ua-daemon/src/ua-manager-device-db.c index 311ff5e..2f9f182 100644 --- a/ua-daemon/src/ua-manager-device-db.c +++ b/ua-daemon/src/ua-manager-device-db.c @@ -487,11 +487,11 @@ int _ua_device_db_insert_device_info(int user_id, error_code, handle_error); DB_ACTION(sqlite3_bind_int(stmt, 9, dev_info->discriminant), error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 10, &(dev_info->payload.service_id), -1, SQLITE_TRANSIENT), + DB_ACTION(sqlite3_bind_text(stmt, 10, &(dev_info->payload.service_id), 1, SQLITE_TRANSIENT), + error_code, handle_error); // fourth parameter is number of bytes, set to 1 to store one byte + DB_ACTION(sqlite3_bind_text(stmt, 11, &(dev_info->payload.purpose), 1, SQLITE_TRANSIENT), error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 11, &(dev_info->payload.purpose), -1, SQLITE_TRANSIENT), - error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.duid, -1, SQLITE_TRANSIENT), + DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.duid, UAM_BLE_PAYLOAD_DUID_LEN + 1, SQLITE_TRANSIENT), error_code, handle_error); DB_ACTION(sqlite3_bind_int(stmt, 13, max_device_number + 1), error_code, handle_error);