metadataengine/server/src/mdsimportexport.cpp
branchRCL_3
changeset 6 646a02f170b9
parent 2 b73a2e62868f
child 19 b73252188534
equal deleted inserted replaced
3:6752808b2036 6:646a02f170b9
   568 		    	User::Leave( KErrCorrupt );
   568 		    	User::Leave( KErrCorrupt );
   569 		    	}
   569 		    	}
   570 		    
   570 		    
   571 		    // Text properties may have an extra flag: index flag.
   571 		    // Text properties may have an extra flag: index flag.
   572 		    TBool indexed( EFalse );
   572 		    TBool indexed( EFalse );
       
   573 		    // Ignore error code as the flag might not exist and indexing is not mandatory
   573 		    ImportNum( indexed, aParser );
   574 		    ImportNum( indexed, aParser );
   574     		// Add this property to the previously defined object.
   575     		// Add this property to the previously defined object.
   575     		iLastObjectDef->AddPropertyL( name, type, minVal32, maxVal32, readOnly, mandatory, indexed );
   576     		iLastObjectDef->AddPropertyL( name, type, minVal32, maxVal32, readOnly, mandatory, indexed );
   576     		break;
   577     		break;
   577     		}
   578     		}
   874 	TInt64 minorVersion = 0;
   875 	TInt64 minorVersion = 0;
   875 
   876 
   876 	// DB version
   877 	// DB version
   877     MMdsPreferences::GetL( KMdsDBVersionName, MMdsPreferences::EPreferenceBothGet,
   878     MMdsPreferences::GetL( KMdsDBVersionName, MMdsPreferences::EPreferenceBothGet,
   878     						  majorVersion, &minorVersion );
   879     						  majorVersion, &minorVersion );
   879 	if ( majorVersion != KMdSServMajorVersionNumber && (TInt)minorVersion != KMdSServMinorVersionNumber )
   880 	if ( majorVersion != KMdSServMajorVersionNumber || (TInt64)minorVersion != KMdSServMinorVersionNumber )
   880 		{
   881 		{
   881 		return EFalse;
   882 		return EFalse;
   882 		}
   883 		}
   883 
   884 
   884 	// schema version
   885 	// schema version
  1163 	    		beginUri.Compare( KColonBackslashMatch ) == 0 )
  1164 	    		beginUri.Compare( KColonBackslashMatch ) == 0 )
  1164 	    	{
  1165 	    	{
  1165 			// check if uri exists
  1166 			// check if uri exists
  1166 			if ( !BaflUtils::FileExists( iFs, textValue ) )
  1167 			if ( !BaflUtils::FileExists( iFs, textValue ) )
  1167 				{
  1168 				{
       
  1169 			    iLastObjectDef = NULL;
  1168 				_LIT( KError, "uri is not real" );
  1170 				_LIT( KError, "uri is not real" );
  1169 				LogError( KError );
  1171 				LogError( KError );
  1170 				User::Leave( KErrNotFound );
  1172 				User::Leave( KErrNotFound );
  1171 				}
  1173 				}
  1172 	    	}
  1174 	    	}
  1718 			{
  1720 			{
  1719 			aItems.ReceiveL( objectDefId );
  1721 			aItems.ReceiveL( objectDefId );
  1720 			const CMdsObjectDef* objectDef = namespaceDefRestrict->GetObjectByIdL( objectDefId );
  1722 			const CMdsObjectDef* objectDef = namespaceDefRestrict->GetObjectByIdL( objectDefId );
  1721 			if (objectDef)
  1723 			if (objectDef)
  1722 				{
  1724 				{
  1723 				objectDefToExport.Append( objectDef );
  1725 				objectDefToExport.AppendL( objectDef );
  1724 				}
  1726 				}
  1725 			}
  1727 			}
  1726 		}
  1728 		}
  1727 
  1729 
  1728 	// Get all event definitions from buffer.
  1730 	// Get all event definitions from buffer.
  1739 			{
  1741 			{
  1740 			aItems.ReceiveL( eventDefId );
  1742 			aItems.ReceiveL( eventDefId );
  1741 			const CMdsEventDef* eventDef = namespaceDefRestrict->GetEventByIdL( eventDefId );
  1743 			const CMdsEventDef* eventDef = namespaceDefRestrict->GetEventByIdL( eventDefId );
  1742 			if (eventDef)
  1744 			if (eventDef)
  1743 				{
  1745 				{
  1744 				eventDefToExport.Append( eventDef );
  1746 				eventDefToExport.AppendL( eventDef );
  1745 				}
  1747 				}
  1746 			}
  1748 			}
  1747 		}
  1749 		}
  1748 
  1750 
  1749 	// Get all relation definitions from buffer.
  1751 	// Get all relation definitions from buffer.
  1760 			{
  1762 			{
  1761 			aItems.ReceiveL( relationDefId );
  1763 			aItems.ReceiveL( relationDefId );
  1762 			const CMdsRelationDef* relationDef = namespaceDefRestrict->GetRelationByIdL( relationDefId );
  1764 			const CMdsRelationDef* relationDef = namespaceDefRestrict->GetRelationByIdL( relationDefId );
  1763 			if ( relationDef )
  1765 			if ( relationDef )
  1764 				{
  1766 				{
  1765 				relationDefToExport.Append( relationDef );
  1767 				relationDefToExport.AppendL( relationDef );
  1766 				}
  1768 				}
  1767 			}
  1769 			}
  1768 		}
  1770 		}
  1769 
  1771 
  1770 	CMdsClauseBuffer* clause = CMdsClauseBuffer::NewLC( 2048 );
  1772 	CMdsClauseBuffer* clause = CMdsClauseBuffer::NewLC( 2048 );
  1773 	RRowData dataRow;
  1775 	RRowData dataRow;
  1774 	CleanupClosePushL( dataRow );
  1776 	CleanupClosePushL( dataRow );
  1775 	RRowData freeTextRow;
  1777 	RRowData freeTextRow;
  1776 	CleanupClosePushL( freeTextRow );
  1778 	CleanupClosePushL( freeTextRow );
  1777 
  1779 
  1778 	TInt j;
  1780 	TInt j( 0 );
  1779 	
  1781 	
  1780 	const TInt namespaceCount = aSchemaNew.iNamespaceDefs.Count();
  1782 	const TInt namespaceCount = aSchemaNew.iNamespaceDefs.Count();
  1781 	
  1783 	
  1782 	for ( TInt i = 0; i < namespaceCount; ++i )
  1784 	for ( TInt i = 0; i < namespaceCount; ++i )
  1783 		{
  1785 		{
  2406 // ImportInt64
  2408 // ImportInt64
  2407 // ------------------------------------------------
  2409 // ------------------------------------------------
  2408 //
  2410 //
  2409 TInt CMdsImportExport::ImportInt64( Int64& aValue, TLex8& aParser )
  2411 TInt CMdsImportExport::ImportInt64( Int64& aValue, TLex8& aParser )
  2410     {
  2412     {
       
  2413     TInt error( KErrNone );
  2411     // due to symbian int64 parser error
  2414     // due to symbian int64 parser error
  2412     // for now we will use ImportNum version
  2415     // for now we will use ImportNum version
  2413     ImportNum( aValue, aParser );
  2416     error = ImportNum( aValue, aParser );
  2414 
  2417 
  2415     return KErrNone;
  2418     return error;
  2416     }
  2419     }
  2417 
  2420 
  2418 // ------------------------------------------------
  2421 // ------------------------------------------------
  2419 // ImportTime
  2422 // ImportTime
  2420 // ------------------------------------------------
  2423 // ------------------------------------------------