4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 #include <glib-object.h>
28 #include <glib/gstdio.h>
31 #include "media-svc.h"
32 #include "media-svc-util.h"
33 #include "media-svc-debug.h"
35 #include "audio-svc.h"
36 #include "visual-svc.h"
38 void test_connect_disconn();
39 int test_query(sqlite3* handle);
42 static int _ite_cluster_fn( Mcluster* item, void* user_data)
44 GList** list = (GList**) user_data;
45 *list = g_list_append( *list, item );
50 static int _ite_fn( Mitem* item, void* user_data)
52 GList** list = (GList**) user_data;
53 *list = g_list_append( *list, item );
58 static int _ite_tag_fn(Mtag* t_item, void* user_data)
60 GList** list = (GList**) user_data;
61 *list = g_list_append( *list, t_item );
66 static int _bm_ite_fn( Mbookmark *bookmark, void *user_data )
69 printf("bookmark is NULL!\n");
73 GList** list = (GList**) user_data;
74 *list = g_list_append(*list, bookmark);
79 int main(int argc, char *argv[])
88 Mcluster* cluster = NULL;
89 minfo_cluster_filter cluster_filter;
90 minfo_item_filter item_filter;
93 if(argc < 2) return -1;
95 MediaSvcHandle *handle = NULL;
96 err = media_svc_connect(&handle);
98 mediainfo_dbg("media_svc_connect fails");
101 mediainfo_dbg("media_svc_connect succeeds");
103 test_case = atoi(argv[1]);
105 switch( test_case ) {
107 test_connect_disconn();
110 audio_svc_create_table(handle);
116 //err = minfo_add_tag("1bf63a42-0530-3cb8-94a1-564d603d85e8", "ZZOON");
117 //err = minfo_add_tag("1bf63a42-0530-3cb8-94a1-564d603d85e8", "HELLO");
119 //err = minfo_add_tag("2ba2cd51-e93f-af54-c1c2-b29a19fd97d0", "ZZOON");
120 //err = minfo_rename_tag("HIHI", "ZZOON");
121 //err = minfo_rename_tag_by_id("2ba2cd51-e93f-af54-c1c2-b29a19fd97d0", "ZZOON", "HELLOHELLO");
122 //err = minfo_delete_tag("2ba2cd51-e93f-af54-c1c2-b29a19fd97d0", "HELLOHELLO");
125 // Test for tag or media list
126 err = minfo_get_media_list_by_tagname(handle, "ZZOON", FALSE, _ite_fn, &p_list);
128 printf("minfo_get_media_list_by_tagname fails : %d\n", err );
132 for( i = 0; i < g_list_length(p_list); i++ ) {
133 item = (Mitem*)g_list_nth_data(p_list, i);
134 printf("media ID[%d]:%s\n", i, item->uuid );
135 printf("path[%d]:%s\n", i, item->file_url );
136 printf("display_name[%d]:%s\n", i, item->display_name );
142 printf("\n-------------------------------------------\n");
144 err = minfo_get_tag_list_by_media_id(handle, "2ba2cd51-e93f-af54-c1c2-b29a19fd97d0", _ite_tag_fn, &p_list);
146 printf("minfo_get_media_list_by_tagname fails : %d\n", err );
150 for( i = 0; i < g_list_length(p_list); i++ ) {
151 tag = (Mtag*)g_list_nth_data(p_list, i);
152 printf("media ID[%d]:%s\n", i, tag->media_uuid );
153 printf("tag name[%d]:%s\n", i, tag->tag_name );
154 printf("count[%d]:%d\n", i, tag->count );
159 printf("\n-------------------------------------------\n");
161 err = minfo_get_tag_list_by_media_id(handle, "1bf63a42-0530-3cb8-94a1-564d603d85e8", _ite_tag_fn, &p_list);
163 printf("minfo_get_media_list_by_tagname fails : %d\n", err );
167 for( i = 0; i < g_list_length(p_list); i++ ) {
168 tag = (Mtag*)g_list_nth_data(p_list, i);
169 printf("media ID[%d]:%s\n", i, tag->media_uuid );
170 printf("tag name[%d]:%s\n", i, tag->tag_name );
171 printf("count[%d]:%d\n", i, tag->count );
179 printf("Test for cluster\n");
180 memset(&cluster_filter, 0x00, sizeof(minfo_cluster_filter));
181 //filter.sort_type = MINFO_CLUSTER_SORT_BY_NAME_ASC;
182 cluster_filter.sort_type = MINFO_CLUSTER_SORT_BY_NAME_DESC;
183 //filter.start_pos = filter.end_pos = -1;
184 cluster_filter.start_pos = 0;
185 cluster_filter.end_pos = 5;
187 err = minfo_get_cluster_list(handle, cluster_filter, _ite_cluster_fn, &p_list);
189 printf("minfo_get_cluster_list fail : %d\n", err);
193 for( i = 0; i < g_list_length(p_list); i++ ) {
194 cluster = (Mcluster*)g_list_nth_data(p_list, i);
195 printf("cluster UUID[%d]:%s\n", i, cluster->uuid );
196 printf("display_name[%d]:%s\n", i, cluster->display_name );
202 // Test for multi-threads
203 printf("Test for multi-threads\n");
204 pthread_t p_thread[1];
208 const char *media_id = "2b0a4efe-c3cb-cb62-fe12-3f4f7aef4ab9";
210 thr_id = pthread_create(&p_thread[0], NULL, do_newjob, NULL);
212 pthread_join(p_thread[0], (void **) &status);
214 err = minfo_update_media_name(handle, media_id, "New.JPG");
217 printf("minfo_update_media_name failed\n");
224 printf("Test minfo_get_item_list\n");
225 memset(&item_filter, 0x00, sizeof(minfo_item_filter));
227 item_filter.file_type = MINFO_ITEM_ALL;
228 item_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_ASC;
229 item_filter.start_pos = 0;
230 item_filter.end_pos = 10;
231 item_filter.with_meta = 0;
232 item_filter.favorite = MINFO_MEDIA_FAV_ALL;
233 const char *_id = "fae82467-6e74-475c-8414-40f011130c6d";
236 err = minfo_get_item_list(handle, _id, item_filter, _ite_fn, &p_list);
239 printf("minfo_get_item_list failed\n");
243 if( p_list == NULL ) printf("failed!\n");
245 for( i = 0; i < g_list_length(p_list); i++ ) {
246 item = (Mitem*)g_list_nth_data(p_list, i);
247 printf("media ID[%d]:%s\n", i, item->uuid );
248 printf("path[%d]:%s\n", i, item->file_url );
249 printf("display_name[%d]:%s\n", i, item->display_name );
250 printf("size[%d]:%d\n", i, item->size );
251 printf("thumb url[%d]:%s(length:%d)\n", i, item->thumb_url, strlen(item->thumb_url) );
254 /* delete list to avoid memory leak */
255 for( i = 0; i < g_list_length(p_list); i++ ) {
256 item = (Mitem*)g_list_nth_data(p_list, i);
257 minfo_destroy_mtype_item(item);
266 printf("Test minfo_get_all_item_list\n");
267 memset(&item_filter, 0x00, sizeof(minfo_item_filter));
269 item_filter.file_type = MINFO_ITEM_ALL;
270 item_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_ASC;
271 item_filter.start_pos = 0;
272 item_filter.end_pos = 10;
273 item_filter.with_meta = true;
274 item_filter.favorite = MINFO_MEDIA_FAV_ALL;
277 err = minfo_get_all_item_list(handle, MINFO_CLUSTER_TYPE_ALL, item_filter, _ite_fn, &p_list);
280 printf("minfo_get_all_item_list failed\n");
284 if( p_list == NULL ) printf("failed!\n");
286 for( i = 0; i < g_list_length(p_list); i++ ) {
287 item = (Mitem*)g_list_nth_data(p_list, i);
288 printf("media ID[%d]:%s\n", i, item->uuid );
289 printf("path[%d]:%s\n", i, item->file_url );
290 printf("display_name[%d]:%s\n", i, item->display_name );
291 printf("size[%d]:%d\n", i, item->size );
292 printf("thumb url[%d]:%s(length:%d)\n", i, item->thumb_url, strlen(item->thumb_url) );
294 if (item->type == MINFO_ITEM_VIDEO) {
295 printf("genre : %s\n", item->meta_info->video_info->genre);
299 /* delete list to avoid memory leak */
300 for( i = 0; i < g_list_length(p_list); i++ ) {
301 item = (Mitem*)g_list_nth_data(p_list, i);
302 minfo_destroy_mtype_item(item);
310 printf("Test minfo_delete_media_id\n");
312 err = minfo_delete_media_id(handle, "12ca468c-994d-f62c-7229-a361c3a6c2a1");
315 printf("minfo_delete_media_id failed\n");
322 printf("Test for minfo_get_cluster\n");
323 Mcluster *cluster = NULL;
325 err = minfo_get_cluster(handle, NULL, NULL, &cluster);
327 printf("minfo_get_cluster_list fail : %d\n", err);
334 printf("Test minfo_get_media_list_by_tagname_with_filter\n");
336 GList *p_list = NULL;
337 minfo_tag_filter filter;
339 filter.start_pos = 1;
341 filter.file_type = MINFO_ITEM_VIDEO;
342 filter.with_meta = 0;
344 //get a media items' list who are included to the same tag with 'test tag'.
345 err = minfo_get_media_list_by_tagname_with_filter(handle, "gd", filter, _ite_fn, &p_list);
348 printf( "failed to get a media items' list. error code->%d", err);
352 for( i = 0; i < g_list_length(p_list); i++ ) {
353 item = (Mitem*)g_list_nth_data(p_list, i);
354 printf("media ID[%d]:%s\n", i, item->uuid );
355 printf("path[%d]:%s\n", i, item->file_url );
356 printf("display_name[%d]:%s\n", i, item->display_name );
365 printf("Test get count\n");
367 const char *cluster_id = "8ddcdba9-9df4-72b4-4890-8d21d13854ad";
368 minfo_cluster_filter c_filter;
369 minfo_item_filter m_filter;
371 memset(&c_filter, 0x00, sizeof(minfo_cluster_filter));
372 c_filter.cluster_type = MINFO_CLUSTER_TYPE_ALL;
373 c_filter.sort_type = MINFO_CLUSTER_SORT_BY_NAME_DESC;
374 c_filter.start_pos = c_filter.end_pos = -1;
376 memset(&m_filter, 0x00, sizeof(minfo_item_filter));
377 m_filter.file_type = MINFO_ITEM_ALL;
378 m_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_ASC;
379 m_filter.start_pos = -1;
380 m_filter.end_pos = -1;
381 m_filter.with_meta = 0;
382 m_filter.favorite = MINFO_MEDIA_FAV_ALL;
384 err = minfo_get_cluster_cnt(handle, c_filter, &count);
387 printf( "failed to get a media items' list. error code->%d", err);
389 printf( "Clouster count : %d\n", count);
392 err = minfo_get_item_cnt(handle, cluster_id, m_filter, &count);
395 printf( "failed to get a media items' list. error code->%d", err);
397 printf( "media count in cluster[%s] : %d\n", cluster_id, count);
403 printf("test minfo_add_media\n");
407 printf("Enter path and type( \"exit 0\" to quit ) : ");
408 scanf("%s %d", path, &type);
410 if( strcmp(path, "exit") == 0 ) break;
412 struct timeval time1;
413 struct timeval time2;
414 gettimeofday(&time1, NULL);
416 err = minfo_add_media(handle, path, type);
418 printf("minfo_add_media fails ( path : %s, type : %d )\n", path, type );
420 printf("minfo_add_media succeed ( path : %s, type : %d )\n", path, type );
423 gettimeofday(&time2, NULL);
425 printf("Time : %ld\n", (time2.tv_sec * 1000000 + time2.tv_usec) -
426 (time1.tv_sec * 1000000 + time1.tv_usec));
432 printf("Test minfo_delete_media_id\n");
434 char inserted_media_uuid[256] = {0,};
435 printf("Enter media id: ");
436 scanf("%s", inserted_media_uuid);
438 err = minfo_delete_media_id(handle, inserted_media_uuid);
440 printf("minfo_delete_media_id fails\n");
442 printf("minfo_delete_media_id succeeds\n");
449 printf("test minfo_add_web_media\n");
452 const char *cluster_id = "8ddcdba9-9df4-72b4-4890-8d21d13854ad";
454 //add a web media to a web album.
455 err = minfo_add_web_media_with_type(handle, cluster_id, "http://user/specifying/address", "web_media", MINFO_ITEM_IMAGE, "thumbnail name");
458 printf( "failed to add to a web album. error code->%d", err);
465 printf("test minfo_update_cluster_name\n");
469 //add a web media to a web album.
470 err = minfo_update_cluster_name(handle, "8ddcdba9-9df4-72b4-4890-8d21d13854ad", "hey");
473 printf( "failed to add to a web album. error code->%d", err);
480 printf("test to get the latest item in camera shots\n");
481 char cluster_id[256] = {0,};
483 //add a web media to a web album.
484 err = minfo_get_cluster_id_by_url(handle, "/opt/media/Images and videos/hey", cluster_id, sizeof(cluster_id));
487 printf( "failed to minfo_get_cluster_id_by_url. error code->%d", err);
491 printf("Cluster ID : %s\n", cluster_id);
493 memset(&item_filter, 0x00, sizeof(minfo_item_filter));
495 item_filter.file_type = MINFO_ITEM_ALL;
496 item_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_DESC;
497 item_filter.start_pos = 0;
498 item_filter.end_pos = 1;
499 item_filter.with_meta = false;
500 item_filter.favorite = MINFO_MEDIA_FAV_ALL;
503 err = minfo_get_item_list(handle, cluster_id, item_filter, _ite_fn, &p_list);
506 printf("minfo_get_item_list failed\n");
510 if( p_list == NULL ) printf("failed!\n");
512 for( i = 0; i < g_list_length(p_list); i++ ) {
513 item = (Mitem*)g_list_nth_data(p_list, i);
514 printf("media ID[%d]:%s\n", i, item->uuid );
515 printf("path[%d]:%s\n", i, item->file_url );
516 printf("display_name[%d]:%s\n", i, item->display_name );
519 /* delete list to avoid memory leak */
520 for( i = 0; i < g_list_length(p_list); i++ ) {
521 item = (Mitem*)g_list_nth_data(p_list, i);
522 minfo_destroy_mtype_item(item);
532 printf("Test minfo_get_item_list_search\n");
533 memset(&item_filter, 0x00, sizeof(minfo_item_filter));
535 const char *search_str = "Ima";
536 minfo_search_field_t search_field = MINFO_SEARCH_BY_HTTP_URL | MINFO_SEARCH_BY_PATH | MINFO_SEARCH_BY_NAME;
537 minfo_folder_type folder_type = MINFO_CLUSTER_TYPE_ALL;
539 item_filter.file_type = MINFO_ITEM_ALL;
540 item_filter.sort_type = MINFO_MEDIA_SORT_BY_NAME_ASC;
541 item_filter.start_pos = 0;
542 item_filter.end_pos = 9;
543 item_filter.with_meta = 0;
544 item_filter.favorite = MINFO_MEDIA_FAV_ALL;
548 err = minfo_get_item_list_search(handle, search_field, search_str, folder_type, item_filter, _ite_fn, &p_list);
550 printf("minfo_get_item_list_search failed\n");
554 if (p_list == NULL) printf("failed!\n");
555 else printf("success\n");
557 for (i = 0; i < g_list_length(p_list); i++) {
558 item = (Mitem*)g_list_nth_data(p_list, i);
559 printf("media ID[%d]:%s\n", i, item->uuid );
560 printf("path[%d]:%s\n", i, item->file_url );
561 printf("display_name[%d]:%s\n", i, item->display_name );
562 printf("thumb url[%d]:%s(length:%d)\n", i, item->thumb_url, strlen(item->thumb_url) );
565 /* delete list to avoid memory leak */
566 for (i = 0; i < g_list_length(p_list); i++) {
567 item = (Mitem*)g_list_nth_data(p_list, i);
568 minfo_destroy_mtype_item(item);
579 printf("test minfo_update_image_meta_info_int\n");
580 const char *media_uuid = "12ca468c-994d-f62c-7229-a361c3a6c2a1";
584 //add a web media to a web album.
585 err = minfo_update_image_meta_info_int(handle, media_uuid, MINFO_IMAGE_META_WIDTH, width,
586 MINFO_IMAGE_META_HEIGHT, height, -1);
588 printf( "minfo_update_image_meta_info_int failed->%d\n", err);
590 printf( "minfo_update_image_meta_info_int success\n");
598 printf("test _media_info_generate_uuid\n");
599 printf("UUID : %s\n", (char*)_media_info_generate_uuid());
604 printf("test minfo_get_bookmark_list\n");
606 const char *media_uuid = NULL;
609 if (p_list) printf("p list does exist\n");
611 media_uuid = argv[2];
613 printf("please insert media id\n");
617 //add a web media to a web album.
618 err = minfo_get_bookmark_list(handle, media_uuid, _bm_ite_fn, &_list);
620 printf( "minfo_get_bookmark_list failed->%d\n", err);
622 printf( "minfo_get_bookmark_list success\n");
626 Mbookmark* bm = NULL;
627 for( i = 0; i < g_list_length(_list); i++ ) {
628 bm = (Mbookmark*)g_list_nth_data(_list, i);
629 printf("Thumb[%d]:%s\n", i, bm->thumb_url );
637 printf("test minfo_get_item\n");
639 const char *url = "/opt/media/Images and videos/My video clips/Helicopter.mp4";
641 err = minfo_get_item(handle, url, &mitem);
644 printf("minfo_get_item failed");
648 printf("mitem->path : %s\n", mitem->file_url);
649 printf("mitem->display_name : %s\n", mitem->display_name);
652 printf("test minfo_get_all_item_conut\n");
654 minfo_folder_type f_type = MINFO_CLUSTER_TYPE_LOCAL_ALL;
655 //minfo_folder_type f_type = MINFO_CLUSTER_TYPE_LOCAL_PHONE;
656 //minfo_media_favorite_type fav_type = MINFO_MEDIA_FAV_ALL;
657 minfo_media_favorite_type fav_type = MINFO_MEDIA_FAV_ONLY;
659 minfo_file_type file_type = MINFO_ITEM_ALL;
660 //minfo_file_type file_type = MINFO_ITEM_IMAGE;
662 err = minfo_get_all_item_count(handle, f_type, file_type, fav_type, &cnt);
665 printf("minfo_get_all_item_conut failed");
669 printf("count : %d\n", cnt);
673 printf("test minfo_get_thumb_path \n");
674 char thumb_path[255] = {0,};
676 if(argv[2] && argv[3]) {
677 int type = atoi(argv[3]);
679 err = minfo_get_thumb_path(handle, argv[2], thumb_path, 255);
680 } else if( type == 2) {
681 err = minfo_get_thumb_path_for_video(handle, argv[2], thumb_path, 255);
683 printf("minfo_get_thumb_path fails( invalid type )\n" );
688 printf("minfo_get_thumb_path fails\n" );
693 printf("minfo_get_thumb_path : %s\n", thumb_path);
697 printf("test minfo_delete_invalid_media_records \n");
699 err = minfo_delete_invalid_media_records(handle, 1);
703 printf("minfo_delete_invalid_media_records fails\n");
708 printf("minfo_delete_invalid_media_records succeeds.\n");
711 /* ------------------- Test for audio ---------------- */
714 printf("test audio_svc_insert_item\n");
718 printf("Enter path ( \"exit\" to quit ) : ");
721 if( strcmp(path, "exit") == 0 ) break;
723 err = audio_svc_insert_item(handle, AUDIO_SVC_STORAGE_PHONE, path, AUDIO_SVC_CATEGORY_MUSIC);
724 if (err != AUDIO_SVC_ERROR_NONE) {
725 fprintf(stderr,"[errer to insert music] : %s\n", path);
733 printf("test audio_svc_delete_item_by_path\n");
737 printf("Enter path ( \"exit\" to quit ) : ");
740 if( strcmp(path, "exit") == 0 ) break;
742 err = audio_svc_delete_item_by_path(handle, path);
743 if (err != AUDIO_SVC_ERROR_NONE) {
744 fprintf(stderr,"[errer to delete music] : %s\n", path);
752 printf("test audio_svc_get_list_item - AUDIO_SVC_TRACK_BY_SEARCH\n");
753 int offset = 0, count = 10, i = 0;
754 const char *str = "Sa";
755 AudioHandleType *a_handle = NULL;
757 err = audio_svc_search_item_new(&a_handle, count);
759 printf("audio_svc_search_item_new failed:%d\n", err);
763 err = audio_svc_list_by_search(handle, a_handle, AUDIO_SVC_ORDER_BY_TITLE_ASC, offset, count, AUDIO_SVC_SEARCH_TITLE, str, strlen(str), AUDIO_SVC_SEARCH_ALBUM, str, strlen(str), AUDIO_SVC_SEARCH_ARTIST, str, strlen(str), -1);
765 if (err != AUDIO_SVC_ERROR_NONE) {
766 mediainfo_dbg("Fail to get items : %d", err);
770 for (i = 0; i < count; i++) {
771 AudioHandleType *item = NULL;
772 err = audio_svc_search_item_get(handle, i, &item);
773 char *title = NULL, *artist = NULL, *pathname = NULL, *album = NULL;
774 char *audio_id = NULL;
778 printf("[%d] audio_svc_search_item_get failed : %d\n", i, err);
780 audio_svc_item_get_val(item,
781 AUDIO_SVC_TRACK_DATA_AUDIO_ID, &audio_id, &size,
782 AUDIO_SVC_TRACK_DATA_PATHNAME, &pathname, &size,
783 AUDIO_SVC_TRACK_DATA_TITLE, &title, &size,
784 AUDIO_SVC_TRACK_DATA_ARTIST, &artist, &size,
785 AUDIO_SVC_TRACK_DATA_ALBUM, &album, &size,
788 if( audio_id == NULL ) break;
790 printf("[%d] ID: %s\n", i, audio_id);
791 printf("[%d] Path: %s\n", i, pathname);
792 printf("[%d] Title: %s\n", i, title);
793 printf("[%d] Artist: %s\n", i, artist);
794 printf("[%d] Album: %s\n", i, album);
798 audio_svc_search_item_free(handle);
805 printf("Test audio_svc_update_item_metadata\n");
808 err = audio_svc_update_item_metadata(31, AUDIO_SVC_TRACK_DATA_PLAYED_COUNT, count, -1);
812 printf("audio_svc_update_item_metadata failed\n");
815 printf("play count is now %d\n", count);
825 err = media_svc_disconnect(handle);
827 mediainfo_dbg("media_svc_disconnect fails");
830 printf("End of Test\n");
838 MediaSvcHandle *handle = NULL;
839 err = media_svc_connect(&handle);
841 mediainfo_dbg("media_svc_connect fails");
844 const char *media_id = "2b0a4efe-c3cb-cb62-fe12-3f4f7aef4ab9";
846 err = minfo_update_media_name(handle, media_id, "New1.JPG");
849 printf("minfo_update_media_name failed\n");
853 printf("Calling media_svc_disconnect in do_newjob \n");
854 err = media_svc_disconnect(handle);
856 mediainfo_dbg("media_svc_disconnect fails");
860 printf("do_newjob done\n");
866 void test_connect_disconn()
870 MediaSvcHandle *handle = NULL;
871 err = media_svc_connect(&handle);
873 mediainfo_dbg("Error");
875 } else { mediainfo_dbg("success"); }
877 if(handle == NULL) mediainfo_dbg("NULL!!!!!");
878 test_query((sqlite3 *)handle);
880 err = media_svc_disconnect(handle);
882 mediainfo_dbg("Error");
886 mediainfo_dbg("test_connect_disconn success");
891 int test_query(sqlite3* handle)
894 sqlite3_stmt* stmt = NULL;
895 char query_string[255];
896 memset(query_string, 0, sizeof(query_string) );
898 if( handle == NULL ) {
899 mediainfo_dbg( "handle is NULL" );
903 snprintf(query_string, sizeof(query_string), "select * from visual_folder where storage_type = 0");
905 err = sqlite3_prepare_v2(handle, query_string, strlen(query_string), &stmt, NULL);
907 if (SQLITE_OK != err)
909 mediainfo_dbg ("prepare error [%s]\n", sqlite3_errmsg(handle));
910 mediainfo_dbg ("query string is %s\n", query_string);
913 err = sqlite3_step(stmt);
914 if (err != SQLITE_ROW)
916 mediainfo_dbg ("end of row [%s]\n", sqlite3_errmsg(handle));
917 mediainfo_dbg ("query string is %s\n", query_string);
918 sqlite3_finalize(stmt);
922 mediainfo_dbg("ID: %d", sqlite3_column_int (stmt, 0));
923 mediainfo_dbg("Display name: %s", (const char*)sqlite3_column_text (stmt, 2));
927 mediainfo_dbg ("mb-svc load data failed");
928 sqlite3_finalize(stmt);
932 sqlite3_finalize(stmt);