Ejemplo n.º 1
0
        /// <summary>
        /// Required method to load the data.
        /// </summary>
        /// <param name="hvo"></param>
        /// <param name="tag"></param>
        /// <param name="ws"></param>
        /// <param name="_cda"></param>
        public override void Load(int hvo, int tag, int ws, SIL.FieldWorks.Common.COMInterfaces.IVwCacheDa _cda)
        {
            // Need to get stem.PartOfSpeech instead of cn.Obj because cn.Obj and cn.Txt may be null!  See LT-6828.
            string sql = "select ls.id, ls.MorphoSyntaxAnalysis, msao.Owner$, msao.class$, ms.txt, ms.fmt, stem.PartOfSpeech, cn.txt from LexSense ls"
                         + " left outer join MultiStr$ ms on ms.obj = ls.id and ms.flid = 5016005 and ms.ws = " + m_cache.DefaultAnalWs
                         + " left outer join MoStemMsa stem on stem.id = ls.MorphoSyntaxAnalysis"
                         + " left outer join CmPossibility_Name cn on stem.PartOfSpeech = cn.obj and cn.ws = " + m_cache.DefaultAnalWs
                         + " left outer join CmObject msao on msao.id = ls.MorphoSyntaxAnalysis";
            IVwOleDbDa dba = m_cache.VwOleDbDaAccessor;
            IDbColSpec dcs = DbColSpecClass.Create();

            dcs.Push((int)DbColType.koctObjVec, 0, this.Tag, 0);
            dcs.Push((int)DbColType.koctObj, 1, (int)LexSense.LexSenseTags.kflidMorphoSyntaxAnalysis, 0);
            dcs.Push((int)DbColType.koctObj, 2, (int)CmObjectFields.kflidCmObject_Owner, 0);
            dcs.Push((int)DbColType.koctInt, 2, (int)CmObjectFields.kflidCmObject_Class, 0);
            dcs.Push((int)DbColType.koctMlsAlt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs);
            dcs.Push((int)DbColType.koctFmt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs);
            dcs.Push((int)DbColType.koctObj, 2, (int)MoStemMsa.MoStemMsaTags.kflidPartOfSpeech, 0);
            dcs.Push((int)DbColType.koctMltAlt, 7, (int)CmPossibility.CmPossibilityTags.kflidName, m_cache.DefaultAnalWs);
            dba.Load(sql, dcs, hvo, 0, null, false);
        }
Ejemplo n.º 2
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();
            }
        }