metadataengine/server/src/mdsimportexport.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 2 b73a2e62868f
--- a/metadataengine/server/src/mdsimportexport.cpp	Mon Jan 18 20:34:07 2010 +0200
+++ b/metadataengine/server/src/mdsimportexport.cpp	Tue Jan 26 12:13:20 2010 +0200
@@ -19,6 +19,7 @@
 #include <charconv.h>
 #include <convgeneratedcpp.h>
 #include <badesca.h>
+#include <bautils.h>
 #include <e32math.h>
 #include <pathinfo.h>
 
@@ -963,6 +964,16 @@
 	iDefaultSchema = &aSchemaNew;
     iLineNumber = 0;
     iFailed = 0;
+    
+    CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
+    RMdSTransaction transaction( connection );
+    CleanupClosePushL(transaction);
+    const TInt beginError( transaction.Error() );
+    if( beginError != KErrNone )
+        {
+        CleanupStack::PopAndDestroy( &transaction );
+        }
+    
     while( ReadMetadataFileLineL() )
         {
         if ( iLine.Length() > 0 )
@@ -978,6 +989,12 @@
 		else
         	iLastLineProcessed = ETrue;
         }
+    
+    if( beginError == KErrNone )
+        {
+        transaction.CommitL();
+        CleanupStack::PopAndDestroy( &transaction );
+        }
 
 	iDefaultSchema = NULL;
     CleanupStack::PopAndDestroy( &iReadStream ); // Closes stream.
@@ -1133,16 +1150,11 @@
 	    		beginUri.Compare( KColonBackslashMatch ) == 0 )
 	    	{
 			// check if uri exists
-	        RFileReadStream tmpFile;
-			TInt err = KErrNone;
-			err = tmpFile.Open( iFs, textValue, EFileRead | EFileShareAny );
-			tmpFile.Close();
-			if ( err != KErrNone )
+			if ( !BaflUtils::FileExists( iFs, textValue ) )
 				{
 				_LIT( KError, "uri is not real" );
-				validUri = EFalse;
 				LogError( KError );
-				error = err;
+				User::Leave( KErrNotFound );
 				}
 	    	}
 	    else