Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Issue: Total number <files/folder/play list> getting on DB sync complete: (3 Items)
   
Issue: Total number <files/folder/play list> getting on DB sync complete  
Hi, 

We are using below code to get the total number files/folders/play-list information on Sync-complete but it prints 
zero's.  Do we missing something to get correct information.

How to get the qdb_database size??? I think have to use ' qdb_getdbsize(..)' API calls to get the DB size.  But it 
returns pages & sizes.  Is that correct????


Code:

case MME_EVENT_MS_SYNCCOMPLETE: // 13 - Synchronization of the mediastore is complete.
			{
				printf("Sync status thread received MME_EVENT_MS_SYNCCOMPLETE event \n");


				// print_execution_time(m_tsStartTime);

				int iScope = QDB_ATTACH_DEFAULT;  // QDB_ATTACH_ALWAYS | QDB_ATTACH_NEVER
				uint32_t page_size = 0, total_pages = 0, free_pages = 0 ;

				//  Return the size of a database
				int iDBSize = qdb_getdbsize(m_mmestatus.hQDB, iScope, &page_size, &total_pages, &free_pages);
				printf("MME databse size(%d), page_size(%d), total_pages(%d), free_pages(%d)  \n", iDBSize, page_size, total_pages, 
free_pages);
#endif

	printf ("Mediastore %llu; files %llu; folders %llu; playlists %llu; \n",		((mme_ms_update_data_t*)&mme_event->data)->msid,						
((mme_ms_update_data_t*)&mme_event->data)->added_filecount,				((mme_ms_update_data_t*)&mme_event->data)->added_foldercount,			
((mme_ms_update_data_t*)&mme_event->data)->playlist_count
				);

				break;
			}

Thanks & Regards,
Vadivel
Attachment: Text Sync_Complete_info.txt 1.94 KB
Re: Issue: Total number <files/folder/play list> getting on DB sync complete  
The sync complete event does not contain this data.

Properly, you should be running queries on the database to get these 
totals.  You can do this via qdb's API.

"select count(fid) from library where msid = X and ftype != 5" will give 
you files (the ftype 5 is the device fid)

"select count(folderid) from folders where msid = X" will give you 
folders (including the root '/' folder)

"select count(plid) from playlists where msid = X" will give you playlists


Note that this gives you the totals for that mediastore, NOT the totals 
inserted/changed for that mediastore.  For example, if you are syncing a 
mediastore for the first time and there are 10 files you would have 10 
files added, and 10 files total.  If you then add 2 files to this and 
resync you will have 2 files added and 12 files total.

-- 
Ryan J. Allen
QNX Software Systems
Re: Issue: Total number <files/folder/play list> getting on DB sync complete  
Thanks Ryan! for your support.