Esempio n. 1
0
		/// <summary>
		/// Preload short name
		/// </summary>
		/// <param name="cache"></param>
		public static void PreloadShortName(FdoCache cache)
		{
			cache.LoadAllOfOneWsOfAMultiUnicode((int)
				LexSense.LexSenseTags.kflidGloss,
				"LexSense", cache.DefaultAnalWs);
		}
Esempio n. 2
0
		/// <summary>
		/// Loads the cache with all of the strings which will be needed by the ShortName
		/// property. For performance only.
		/// </summary>
		public static void PreLoadShortName(FdoCache cache)
		{
			// JohnT: there's seldom much point in doing this more than once. (That's bad enough!).
			// The main exception is Refresh, when we throw everything away and start over.
			// There might be other exceptions, such as after a major import.
			if (PreloadPerformedVirtualHandler.PreloadPerformed(cache))
				return;
#if DEBUG
			DateTime dt1 = DateTime.Now;
			int tc1 = System.Environment.TickCount;
#endif
			cache.LoadAllOfOneWsOfAMultiUnicode((int)LexEntry.LexEntryTags.kflidCitationForm,
				"LexEntry", cache.DefaultVernWs);
			// This seems to be needed because many lex entries (at least in some databases,
			// such as the Ron Moe one) don't have citation forms, and hence we go to some
			// related MoForm to get the short name for the lex entry.
			cache.LoadAllOfOneWsOfAMultiUnicode((int)
				MoForm.MoFormTags.kflidForm,
				"MoForm", cache.DefaultVernWs);
			// It seems to me (JohnT) that it should also be necessary to preload the
			// UnderlyingForm and Allomorphs properties, but testing with a large dictionary and
			// SQL profiler seems to confirm that it is not. Apparently something I don't know
			// about is preloading this information...perhaps part of pre-loading the sequence
			// of LexEntry objects?
			// Notice we're not preloading the analysis writing system, on the assumption that
			// that is rare. (JT: but, it isn't rare to CHECK and SEE whether there is an
			// analysis WS of the citation form, if we have that case at all and there is no
			// vernacular CF.  For now, I removed looking for the analysis CF from the ShortName
			// method, so it is OK not to preload it.

			// Preload the homograph numbers which will also be needed for the HeadWord, which
			// is used instead of ShortName when uniqueness is desired. Also include class info
			// to avoid later cache misses when loading the objects.
			IDbColSpec dcs = DbColSpecClass.Create();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctInt, 1,
				(int)CmObjectFields.kflidCmObject_Class, 0);
			dcs.Push((int)DbColType.koctObj, 1,
				(int)CmObjectFields.kflidCmObject_Owner, 0);
			dcs.Push((int)DbColType.koctInt, 1,
				(int)CmObjectFields.kflidCmObject_OwnFlid, 0);
			dcs.Push((int)DbColType.koctTimeStamp, 1, 0, 0);
			dcs.Push((int)DbColType.koctInt, 1,
				(int)LexEntry.LexEntryTags.kflidHomographNumber, 0);
			cache.LoadData("select Id, Class$, Owner$, OwnFlid$, UpdStmp, HomographNumber from LexEntry_", dcs, 0);

			// Preload the LexemeForm for each LexEntry.
			dcs.Clear();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctObjOwn, 1,
				(int)LexEntry.LexEntryTags.kflidLexemeForm, 0);
			cache.LoadData("select Src, Dst from LexEntry_LexemeForm", dcs, 0);

			// Preload the allomorphs for each LexEntry.  This is needed to obtain the morph
			// types, which are properties of the allomorphs.
			dcs.Clear();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctObjVecOwn, 1,
				(int)LexEntry.LexEntryTags.kflidAlternateForms, 0);
			cache.LoadData("select Src, Dst from LexEntry_AlternateForms order by Src,Ord", dcs, 0);

			// Preload the morphtype for each allomorph (MoForm).
			dcs.Clear();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctObj, 1, (int)MoForm.MoFormTags.kflidMorphType,
				0);
			cache.LoadData("select Id,MorphType from MoForm", dcs, 0);

			// Preload the information for MoMorphTypes.
			dcs.Clear();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctUnicode, 1,
				(int)MoMorphType.MoMorphTypeTags.kflidPostfix, 0);
			dcs.Push((int)DbColType.koctUnicode, 1,
				(int)MoMorphType.MoMorphTypeTags.kflidPrefix, 0);
			dcs.Push((int)DbColType.koctInt, 1,
				(int)MoMorphType.MoMorphTypeTags.kflidSecondaryOrder, 0);
			cache.LoadData("select Id,Postfix,Prefix,SecondaryOrder from MoMorphType", dcs, 0);

			PreloadPerformedVirtualHandler.SetPreloadPerformed(cache);
#if DEBUG
			int tc2 = System.Environment.TickCount;
			TimeSpan ts1 = DateTime.Now - dt1;
			string s = "Preloading for LexEntry ShortNames took " + (tc2 - tc1) + " ticks," +
				" or " + ts1.Minutes + ":" + ts1.Seconds + "." +
				ts1.Milliseconds.ToString("d3") + " min:sec.";
			Debug.WriteLine(s);
#endif

			Marshal.ReleaseComObject(dcs); //jdh added dec 1, 2004
		}
Esempio n. 3
0
		/// <summary>
		/// Loads the cache with all of the strings which will be needed by the ShortName
		/// property. For performance only.
		/// </summary>
		public static void PreLoadShortName(FdoCache cache, int ws)
		{
#if DEBUG
			DateTime dt1 = DateTime.Now;
			int tc1 = System.Environment.TickCount;
#endif
			cache.LoadAllOfOneWsOfAMultiUnicode((int)WfiWordform.WfiWordformTags.kflidForm,
				"WfiWordform", ws);

			// Include other basic parts of WfiWordform
			// to avoid later cache misses when loading the objects.
			IDbColSpec dcs = DbColSpecClass.Create();
			dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);	// ID
			dcs.Push((int)DbColType.koctInt, 1,
				(int)CmObjectFields.kflidCmObject_Class, 0);
			dcs.Push((int)DbColType.koctObj, 1,
				(int)CmObjectFields.kflidCmObject_Owner, 0);
			dcs.Push((int)DbColType.koctInt, 1,
				(int)CmObjectFields.kflidCmObject_OwnFlid, 0);
			dcs.Push((int)DbColType.koctTimeStamp, 1, 0, 0);
			cache.LoadData("select Id, Class$, Owner$, OwnFlid$, UpdStmp from CmObject where class$ = "
				+ WfiWordform.kClassId, dcs, 0);

#if DEBUG
			int tc2 = System.Environment.TickCount;
			TimeSpan ts1 = DateTime.Now - dt1;
			string s = "Preloading for WfiWordform ShortNames took " + (tc2 - tc1) + " ticks," +
				" or " + ts1.Minutes + ":" + ts1.Seconds + "." +
				ts1.Milliseconds.ToString("d3") + " min:sec.";
			Debug.WriteLine(s);
#endif

			Marshal.ReleaseComObject(dcs);
		}