示例#1
0
        /// <summary>
        /// Record the current parse timestamp of a whole collection of StTexts
        /// Equivalent to calling RecordParseTimestamp on each of them.
        /// </summary>
        /// <param name="texts"></param>
        public static void RecordParseTimestamps(List <IStText> texts)
        {
            if (texts.Count == 0)
            {
                return;
            }
            FdoCache cache = texts[0].Cache;

            int[] targetHvos = new int[texts.Count];
            for (int i = 0; i < targetHvos.Length; i++)
            {
                targetHvos[i] = texts[i].Hvo;
            }
            int    index       = 0;
            string Hvos        = DbOps.MakePartialIdList(ref index, targetHvos);
            string whereClause = "";

            if (index == targetHvos.Length)
            {
                // If we can make a single where clause we'll do it; otherwise do them all.
                whereClause = " where Owner$ in (" + Hvos + ")";
            }
            string     sql = "select owner$, max(UpdStmp) from StTxtPara_ " + whereClause + " group by owner$";
            IDbColSpec dcs = DbColSpecClass.Create();

            dcs.Push((int)DbColType.koctBaseId, 0, 0, 0);
            int modifyTimestampTag = ParagraphsModifiedTimestampTag(cache);

            dcs.Push((int)DbColType.koctInt64, 1, modifyTimestampTag, 0);
            cache.VwOleDbDaAccessor.Load(sql, dcs, 0, 0, null, false);

            ISilDataAccess sda = cache.MainCacheAccessor;

            foreach (StText text in texts)
            {
                // Much of the logic of RecordParseTimestamp, but can assume modify timestamp is already loaded.
                text.LastParsedTimestamp = sda.get_Int64Prop(text.Hvo, modifyTimestampTag);
                text.ClearLastModifiedTimestamp();
            }
        }