int ret = MS_MEDIA_ERR_NONE;
char *burst_id = NULL;
- const char *db_fields = "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, folder_uuid, \
- thumbnail_path, title, album_id, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, description, \
- category, keyword, location_tag, content_name, age_rating, author, provider, last_played_time, played_count, favourite, \
- bitrate, bitpersample, samplerate, channel, duration, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, \
- rating, is_drm, storage_type, burst_id, timeline, weather, sync_status, \
- file_name_pinyin, title_pinyin, album_pinyin, artist_pinyin, album_artist_pinyin, genre_pinyin, composer_pinyin, copyright_pinyin, description_pinyin, storage_uuid, is_360";
+ const char *db_fields = "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, folder_uuid, thumbnail_path, \
+ title, album_id, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, description, category, keyword, location_tag, \
+ content_name, age_rating, author, provider, last_played_time, played_count, favourite, bitrate, bitpersample, samplerate, channel, duration, \
+ longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, rating, is_drm, storage_type, burst_id, timeline, weather, sync_status, \
+ file_name_pinyin, title_pinyin, album_pinyin, artist_pinyin, album_artist_pinyin, genre_pinyin, composer_pinyin, copyright_pinyin, description_pinyin, storage_uuid, is_360";
+
+ const char *db_fields_basic = "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, folder_uuid, thumbnail_path, \
+ album_id, last_played_time, played_count, favourite, is_drm, storage_type, burst_id, timeline, sync_status, file_name_pinyin, storage_uuid, is_360";
/* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
/* This code will be removed when sqlite3_mprintf works clearly */
}
char *sql = sqlite3_mprintf("INSERT INTO '%s' (%s) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %Q, \
- %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, \
- %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, %d, %d, \
- %d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
- %d, %d, %d, %Q, %d, %Q, %d, \
- %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d);",
- content_info->storage_uuid, db_fields,
- content_info->media_uuid,
- content_info->path,
- content_info->file_name,
- content_info->media_type,
- content_info->mime_type,
- content_info->size,
- content_info->added_time,
- content_info->modified_time,
- content_info->folder_uuid, /**/
- content_info->thumbnail_path,
- content_info->media_meta.title,
- content_info->album_id,
- content_info->media_meta.album,
- content_info->media_meta.artist,
- content_info->media_meta.album_artist,
- content_info->media_meta.genre,
- content_info->media_meta.composer,
- content_info->media_meta.year,
- content_info->media_meta.recorded_date,
- content_info->media_meta.copyright,
- content_info->media_meta.track_num,
- content_info->media_meta.description, /**/
- content_info->media_meta.category,
- content_info->media_meta.keyword,
- content_info->media_meta.location_tag,
- content_info->media_meta.content_name,
- content_info->media_meta.age_rating,
- content_info->media_meta.author,
- content_info->media_meta.provider,
- content_info->last_played_time,
- content_info->played_count,
- content_info->favourate, /**/
- content_info->media_meta.bitrate,
- content_info->media_meta.bitpersample,
- content_info->media_meta.samplerate,
- content_info->media_meta.channel,
- content_info->media_meta.duration,
- content_info->media_meta.longitude,
- content_info->media_meta.latitude,
- content_info->media_meta.altitude,
- content_info->media_meta.exposure_time,
- content_info->media_meta.fnumber,
- content_info->media_meta.iso,
- content_info->media_meta.model,
- content_info->media_meta.width,
- content_info->media_meta.height,
- content_info->media_meta.datetaken,
- content_info->media_meta.orientation,
- content_info->media_meta.rating,
- content_info->is_drm,
- content_info->storage_type,
- burst_id,
- content_info->timeline,
- content_info->media_meta.weather,
- content_info->sync_status,
- content_info->file_name_pinyin,
- content_info->media_meta.title_pinyin,
- content_info->media_meta.album_pinyin,
- content_info->media_meta.artist_pinyin,
- content_info->media_meta.album_artist_pinyin,
- content_info->media_meta.genre_pinyin,
- content_info->media_meta.composer_pinyin,
- content_info->media_meta.copyright_pinyin,
- content_info->media_meta.description_pinyin,
- content_info->storage_uuid,
- content_info->media_meta.is_360
- );
+ %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, %d, %d, \
+ %d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
+ %d, %d, %d, %Q, %d, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d);",
+ content_info->storage_uuid, db_fields,
+ content_info->media_uuid,
+ content_info->path,
+ content_info->file_name,
+ content_info->media_type,
+ content_info->mime_type,
+ content_info->size,
+ content_info->added_time,
+ content_info->modified_time,
+ content_info->folder_uuid, /* 1st line */
+ content_info->thumbnail_path,
+ content_info->media_meta.title,
+ content_info->album_id,
+ content_info->media_meta.album,
+ content_info->media_meta.artist,
+ content_info->media_meta.album_artist,
+ content_info->media_meta.genre,
+ content_info->media_meta.composer,
+ content_info->media_meta.year,
+ content_info->media_meta.recorded_date,
+ content_info->media_meta.copyright,
+ content_info->media_meta.track_num,
+ content_info->media_meta.description,
+ content_info->media_meta.category,
+ content_info->media_meta.keyword,
+ content_info->media_meta.location_tag,
+ content_info->media_meta.content_name,
+ content_info->media_meta.age_rating,
+ content_info->media_meta.author,
+ content_info->media_meta.provider,
+ content_info->last_played_time,
+ content_info->played_count,
+ content_info->favourate, /* 2nd line */
+ content_info->media_meta.bitrate,
+ content_info->media_meta.bitpersample,
+ content_info->media_meta.samplerate,
+ content_info->media_meta.channel,
+ content_info->media_meta.duration,
+ content_info->media_meta.longitude,
+ content_info->media_meta.latitude,
+ content_info->media_meta.altitude,
+ content_info->media_meta.exposure_time,
+ content_info->media_meta.fnumber,
+ content_info->media_meta.iso,
+ content_info->media_meta.model,
+ content_info->media_meta.width,
+ content_info->media_meta.height,
+ content_info->media_meta.datetaken,
+ content_info->media_meta.orientation, /* 3rd line */
+ content_info->media_meta.rating,
+ content_info->is_drm,
+ content_info->storage_type,
+ burst_id,
+ content_info->timeline,
+ content_info->media_meta.weather,
+ content_info->sync_status,
+ content_info->file_name_pinyin,
+ content_info->media_meta.title_pinyin,
+ content_info->media_meta.album_pinyin,
+ content_info->media_meta.artist_pinyin,
+ content_info->media_meta.album_artist_pinyin,
+ content_info->media_meta.genre_pinyin,
+ content_info->media_meta.composer_pinyin,
+ content_info->media_meta.copyright_pinyin,
+ content_info->media_meta.description_pinyin,
+ content_info->storage_uuid,
+ content_info->media_meta.is_360 /* 4th line */
+ );
+
+ /* Check query length */
+ if (sql != NULL && strlen(sql) >= SQLITE3_QUERY_MAX_LEN) {
+ media_svc_debug("Query length is over %d byte.. So, remake query using only basic information..", SQLITE3_QUERY_MAX_LEN);
+ SQLITE3_SAFE_FREE(sql);
+
+ sql = sqlite3_mprintf("INSERT INTO '%s' (%s) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %Q, %Q, %d, %d, %d, %d, %d, %d, %Q, %d, %d, %Q, %Q, %d);",
+ content_info->storage_uuid, db_fields_basic,
+ content_info->media_uuid,
+ content_info->path,
+ content_info->file_name,
+ content_info->media_type,
+ content_info->mime_type,
+ content_info->size,
+ content_info->added_time,
+ content_info->modified_time,
+ content_info->folder_uuid,
+ content_info->thumbnail_path,
+ content_info->album_id,
+ content_info->last_played_time,
+ content_info->played_count,
+ content_info->favourate,
+ content_info->is_drm,
+ content_info->storage_type,
+ burst_id,
+ content_info->timeline,
+ content_info->sync_status,
+ content_info->file_name_pinyin,
+ content_info->storage_uuid,
+ content_info->media_meta.is_360 /* 1st line */
+ );
+ }
if (burst_id) {
sqlite3_free(burst_id);
char *sql = sqlite3_mprintf("UPDATE %s SET title=%Q, album=%Q, artist=%Q, album_artist=%Q, genre=%Q, composer=%Q, copyright=%Q, description=%Q, \
file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q \
WHERE path=%Q;",
- MEDIA_SVC_DB_TABLE_MEDIA,
- content_info->media_meta.title,
- content_info->media_meta.album,
- content_info->media_meta.artist,
- content_info->media_meta.album_artist,
- content_info->media_meta.genre,
- content_info->media_meta.composer,
- content_info->media_meta.copyright,
- content_info->media_meta.description,
- content_info->file_name_pinyin,
- content_info->media_meta.title_pinyin,
- content_info->media_meta.album_pinyin,
- content_info->media_meta.artist_pinyin,
- content_info->media_meta.album_artist_pinyin,
- content_info->media_meta.genre_pinyin,
- content_info->media_meta.composer_pinyin,
- content_info->media_meta.copyright_pinyin,
- content_info->media_meta.description_pinyin,
- content_info->path
+ MEDIA_SVC_DB_TABLE_MEDIA,
+ content_info->media_meta.title,
+ content_info->media_meta.album,
+ content_info->media_meta.artist,
+ content_info->media_meta.album_artist,
+ content_info->media_meta.genre,
+ content_info->media_meta.composer,
+ content_info->media_meta.copyright,
+ content_info->media_meta.description,
+ content_info->file_name_pinyin,
+ content_info->media_meta.title_pinyin,
+ content_info->media_meta.album_pinyin,
+ content_info->media_meta.artist_pinyin,
+ content_info->media_meta.album_artist_pinyin,
+ content_info->media_meta.genre_pinyin,
+ content_info->media_meta.composer_pinyin,
+ content_info->media_meta.copyright_pinyin,
+ content_info->media_meta.description_pinyin,
+ content_info->path
);
if (sql != NULL) {
_media_svc_get_pinyin_str(content_info->media_meta.description, &content_info->media_meta.description_pinyin);
}
- char *sql = sqlite3_mprintf("UPDATE '%s' SET \
- size=%lld, modified_time=%d, thumbnail_path=%Q, title=%Q, album_id=%d, album=%Q, artist=%Q, album_artist=%Q, genre=%Q, \
- composer=%Q, year=%Q, recorded_date=%Q, copyright=%Q, track_num=%Q, description=%Q, \
- bitrate=%d, bitpersample=%d, samplerate=%d, channel=%d, duration=%d, longitude=%f, latitude=%f, altitude=%f, exposure_time=%Q, fnumber=%f, iso=%d, model=%Q, width=%d, height=%d, datetaken=%Q, \
- orientation=%d WHERE path=%Q;",
- storage_id,
- content_info->size,
- content_info->modified_time,
- content_info->thumbnail_path,
- content_info->media_meta.title,
- content_info->album_id,
- content_info->media_meta.album,
- content_info->media_meta.artist,
- content_info->media_meta.album_artist,
- content_info->media_meta.genre,
- content_info->media_meta.composer,
- content_info->media_meta.year,
- content_info->media_meta.recorded_date,
- content_info->media_meta.copyright,
- content_info->media_meta.track_num,
- content_info->media_meta.description,
- content_info->media_meta.bitrate,
- content_info->media_meta.bitpersample,
- content_info->media_meta.samplerate,
- content_info->media_meta.channel,
- content_info->media_meta.duration,
- content_info->media_meta.longitude,
- content_info->media_meta.latitude,
- content_info->media_meta.altitude,
- content_info->media_meta.exposure_time,
- content_info->media_meta.fnumber,
- content_info->media_meta.iso,
- content_info->media_meta.model,
- content_info->media_meta.width,
- content_info->media_meta.height,
- content_info->media_meta.datetaken,
- content_info->media_meta.orientation,
- content_info->path
+ char *sql = sqlite3_mprintf("UPDATE '%s' SET size=%lld, modified_time=%d, thumbnail_path=%Q, title=%Q, album_id=%d, album=%Q, artist=%Q, album_artist=%Q, genre=%Q, \
+ composer=%Q, year=%Q, recorded_date=%Q, copyright=%Q, track_num=%Q, description=%Q, bitrate=%d, bitpersample=%d, samplerate=%d, channel=%d, duration=%d, \
+ longitude=%f, latitude=%f, altitude=%f, exposure_time=%Q, fnumber=%f, iso=%d, model=%Q, width=%d, height=%d, datetaken=%Q, orientation=%d WHERE path=%Q;",
+ storage_id,
+ content_info->size,
+ content_info->modified_time,
+ content_info->thumbnail_path,
+ content_info->media_meta.title,
+ content_info->album_id,
+ content_info->media_meta.album,
+ content_info->media_meta.artist,
+ content_info->media_meta.album_artist,
+ content_info->media_meta.genre,
+ content_info->media_meta.composer,
+ content_info->media_meta.year,
+ content_info->media_meta.recorded_date,
+ content_info->media_meta.copyright,
+ content_info->media_meta.track_num,
+ content_info->media_meta.description,
+ content_info->media_meta.bitrate,
+ content_info->media_meta.bitpersample,
+ content_info->media_meta.samplerate,
+ content_info->media_meta.channel,
+ content_info->media_meta.duration,
+ content_info->media_meta.longitude,
+ content_info->media_meta.latitude,
+ content_info->media_meta.altitude,
+ content_info->media_meta.exposure_time,
+ content_info->media_meta.fnumber,
+ content_info->media_meta.iso,
+ content_info->media_meta.model,
+ content_info->media_meta.width,
+ content_info->media_meta.height,
+ content_info->media_meta.datetaken,
+ content_info->media_meta.orientation,
+ content_info->path
);
ret = _media_svc_sql_query(sql, uid);
char *sql = NULL;
if (thumb_path != NULL) {
- sql = sqlite3_mprintf("UPDATE '%s' SET \
- path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, thumbnail_path=%Q, storage_type=%d, \
- played_count=0, last_played_time=0, last_played_position=0 \
- WHERE path=%Q;",
+ sql = sqlite3_mprintf("UPDATE '%s' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, thumbnail_path=%Q, storage_type=%d, \
+ played_count=0, last_played_time=0, last_played_position=0 WHERE path=%Q;",
storage_id, dest_path, file_name, modified_time, folder_uuid, thumb_path, dest_storage, src_path);
} else {
- sql = sqlite3_mprintf("UPDATE '%s' SET \
- path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, storage_type=%d, \
- played_count=0, last_played_time=0, last_played_position=0 \
- WHERE path=%Q;",
+ sql = sqlite3_mprintf("UPDATE '%s' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, storage_type=%d, \
+ played_count=0, last_played_time=0, last_played_position=0 WHERE path=%Q;",
storage_id, dest_path, file_name, modified_time, folder_uuid, dest_storage, src_path);
}
char * db_fields = (char *)"media_uuid, folder_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, is_drm, storage_type, timeline, burst_id, storage_uuid";
- char *sql = sqlite3_mprintf("INSERT INTO '%s' (%s) VALUES (%Q, %Q, %Q, %Q, %d, %Q, %lld, \
- %d, %d, %d, %d, %d, %Q, %Q);",
+ char *sql = sqlite3_mprintf("INSERT INTO '%s' (%s) VALUES (%Q, %Q, %Q, %Q, %d, %Q, %lld, %d, %d, %d, %d, %d, %Q, %Q);",
storage_id, db_fields,
content_info->media_uuid,
content_info->folder_uuid,
thumbnail_path=%Q, title=%Q, album_id=%d, album=%Q, artist=%Q, album_artist=%Q, genre=%Q, composer=%Q, year=%Q, \
recorded_date=%Q, copyright=%Q, track_num=%Q, description=%Q, bitrate=%d, bitpersample=%d, samplerate=%d, channel=%d, \
duration=%d, longitude=%.6f, latitude=%.6f, altitude=%.6f, width=%d, height=%d, datetaken=%Q, orientation=%d, exposure_time=%Q,\
- fnumber=%.6f, iso=%d, model=%Q, rating=%d, weather=%Q, file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, \
+ fnumber=%.6f, iso=%d, model=%Q, rating=%d, weather=%Q, file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, \
artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q, is_360=%d WHERE path=%Q;",
storage_id,
/* content_info->folder_uuid, */