This page was last modified 19:59, 10 April 2008.
How to compact local landmark databases
From Forum Nokia Wiki
All local landmark databases are stored in files. As a result of some data changes ( for example: the addition of new landmarks ), it could happens that the size of database files will be greater then the necessary minimum.
The following code snippet demonstrates how to compress all local databases and calculate the count of the released bytes.
It is necessary to include the following headers:
- epos_cposlmdatabasemanager.h
- epos_cposlandmarkdatabase.h
- aknnotewrappers.h - for the information note
And link against:
- eposlmdbmanlib.lib
- eposlandmarks.lib
- avkon.lib eikcdlg.lib eikctl.lib - for the information note
// db manager CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager :: NewL(); CleanupStack :: PushL( dbManager ); // protocol for the local DB _LIT( KFileProto, "file" ); // array, that contains URI of the local DBs CDesCArray* dbUriList = dbManager->ListDatabasesLC( KFileProto ); TInt delta = 0; // delta of the total size for(TInt i = 0; i < dbUriList->Count(); i++ ) { // open database CPosLandmarkDatabase* db = CPosLandmarkDatabase :: OpenL( (*dbUriList)[i] ); CleanupStack :: PushL( db ); // initialize if necessary if( db->IsInitializingNeeded() ) ExecuteAndDeleteLD( db->InitializeL() ); // get size before compact CPosLandmarkDatabase :: TSize oldSize = db->SizeL(); // execute compact in batch mode ExecuteAndDeleteLD( db->CompactL() ); // get size after compact CPosLandmarkDatabase :: TSize newSize = db->SizeL(); // inc delta delta += oldSize.iFileSize - newSize.iFileSize; CleanupStack :: PopAndDestroy(); // db } CleanupStack :: PopAndDestroy( 2 ); // iDbList dbManager // create message _LIT( KMess, "Released bytes: " ); TBuf<32> mess( KMess ); mess.AppendNum( delta ); // show message CAknInformationNote* informationNote; informationNote = new ( ELeave ) CAknInformationNote; informationNote->ExecuteLD( mess );
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| registry key | palak_shah_23 | General Symbian C++ | 11 | 2006-11-13 13:41 |
| RSocket SendTo throws KErrTooBig only when sending to mobile network | Lichtens | Symbian Networking & Messaging | 5 | 2008-03-17 08:32 |
| How to get local device TBTDevAddr ? 7650 | cgforero | Bluetooth Technology | 1 | 2003-02-17 07:36 |
| Database convertation | JTOne | General Symbian C++ | 8 | 2007-10-09 08:43 |
| To get Data from Server to local phone | Nokia_Archive | WAP Servers | 1 | 2002-05-14 19:35 |
