metadataengine/server/src/mdsimportexport.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 2 b73a2e62868f
equal deleted inserted replaced
0:c53acadfccc6 1:acef663c1218
    17 
    17 
    18 #include <e32cmn.h>
    18 #include <e32cmn.h>
    19 #include <charconv.h>
    19 #include <charconv.h>
    20 #include <convgeneratedcpp.h>
    20 #include <convgeneratedcpp.h>
    21 #include <badesca.h>
    21 #include <badesca.h>
       
    22 #include <bautils.h>
    22 #include <e32math.h>
    23 #include <e32math.h>
    23 #include <pathinfo.h>
    24 #include <pathinfo.h>
    24 
    25 
    25 #include <mdeconstants.h>
    26 #include <mdeconstants.h>
    26 
    27 
   961         }
   962         }
   962 
   963 
   963 	iDefaultSchema = &aSchemaNew;
   964 	iDefaultSchema = &aSchemaNew;
   964     iLineNumber = 0;
   965     iLineNumber = 0;
   965     iFailed = 0;
   966     iFailed = 0;
       
   967     
       
   968     CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
       
   969     RMdSTransaction transaction( connection );
       
   970     CleanupClosePushL(transaction);
       
   971     const TInt beginError( transaction.Error() );
       
   972     if( beginError != KErrNone )
       
   973         {
       
   974         CleanupStack::PopAndDestroy( &transaction );
       
   975         }
       
   976     
   966     while( ReadMetadataFileLineL() )
   977     while( ReadMetadataFileLineL() )
   967         {
   978         {
   968         if ( iLine.Length() > 0 )
   979         if ( iLine.Length() > 0 )
   969             {
   980             {
   970             // parse the line
   981             // parse the line
   975 			    ++iFailed;
   986 			    ++iFailed;
   976             	}
   987             	}
   977             }
   988             }
   978 		else
   989 		else
   979         	iLastLineProcessed = ETrue;
   990         	iLastLineProcessed = ETrue;
       
   991         }
       
   992     
       
   993     if( beginError == KErrNone )
       
   994         {
       
   995         transaction.CommitL();
       
   996         CleanupStack::PopAndDestroy( &transaction );
   980         }
   997         }
   981 
   998 
   982 	iDefaultSchema = NULL;
   999 	iDefaultSchema = NULL;
   983     CleanupStack::PopAndDestroy( &iReadStream ); // Closes stream.
  1000     CleanupStack::PopAndDestroy( &iReadStream ); // Closes stream.
   984     return iFailed;
  1001     return iFailed;
  1131 	    // URI must begin with "X:\"
  1148 	    // URI must begin with "X:\"
  1132 	    if( 'A' <= driveLetter && driveLetter <= 'Z' && 
  1149 	    if( 'A' <= driveLetter && driveLetter <= 'Z' && 
  1133 	    		beginUri.Compare( KColonBackslashMatch ) == 0 )
  1150 	    		beginUri.Compare( KColonBackslashMatch ) == 0 )
  1134 	    	{
  1151 	    	{
  1135 			// check if uri exists
  1152 			// check if uri exists
  1136 	        RFileReadStream tmpFile;
  1153 			if ( !BaflUtils::FileExists( iFs, textValue ) )
  1137 			TInt err = KErrNone;
       
  1138 			err = tmpFile.Open( iFs, textValue, EFileRead | EFileShareAny );
       
  1139 			tmpFile.Close();
       
  1140 			if ( err != KErrNone )
       
  1141 				{
  1154 				{
  1142 				_LIT( KError, "uri is not real" );
  1155 				_LIT( KError, "uri is not real" );
  1143 				validUri = EFalse;
       
  1144 				LogError( KError );
  1156 				LogError( KError );
  1145 				error = err;
  1157 				User::Leave( KErrNotFound );
  1146 				}
  1158 				}
  1147 	    	}
  1159 	    	}
  1148 	    else
  1160 	    else
  1149 	        {
  1161 	        {
  1150 	        validUri = EFalse;
  1162 	        validUri = EFalse;