/// <summary>
        /// Search and read found records.
        /// </summary>
        public IrbisRecord[] SearchReadSimple
        (
            string key
        )
        {
            int[] mfns = InvertedFile.SearchSimple(key);
            List <IrbisRecord> result = new List <IrbisRecord>();

            foreach (int mfn in mfns)
            {
                try
                {
                    XrfRecord32 xrfRecord = Xrf.ReadRecord(mfn);
                    if (!xrfRecord.Deleted)
                    {
                        MstRecord32 mstRecord = Mst.ReadRecord2(xrfRecord.AbsoluteOffset);
                        if (!mstRecord.Deleted)
                        {
                            IrbisRecord irbisRecord = mstRecord.DecodeRecord();
                            irbisRecord.Database = Database;
                            result.Add(irbisRecord);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 2
0
        //public IrbisRecord ReadRecord2
        //    (
        //        int mfn
        //    )
        //{
        //    XrfRecord xrfRecord = Xrf.ReadRecord(mfn);
        //    MstRecord mstRecord = Mst.ReadRecord2(xrfRecord.Offset);
        //    IrbisRecord result = mstRecord.DecodeRecord();
        //    result.Database = Database;
        //    return result;
        //}

        public int[] SearchSimple(string key)
        {
            int[]      mfns   = InvertedFile.SearchSimple(key);
            List <int> result = new List <int>();

            foreach (int mfn in mfns)
            {
                if (!Xrf.ReadRecord(mfn).Deleted)
                {
                    result.Add(mfn);
                }
            }
            return(result.ToArray());
        }
Ejemplo n.º 3
0
        public IrbisRecord ReadRecord
        (
            int mfn
        )
        {
            XrfRecord xrfRecord = Xrf.ReadRecord(mfn);

            if (xrfRecord.Offset == 0)
            {
                return(null);
            }
            MstRecord   mstRecord = Mst.ReadRecord2(xrfRecord.Offset);
            IrbisRecord result    = mstRecord.DecodeRecord();

            result.Database = Database;
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ibatrak обновление статуса записи на актуализированный
        /// </summary>
        public void SetRecordActualized(IrbisRecord record, bool keepLock, bool ifUpdate, bool padding)
        {
            if (record == null || record.Mfn <= 0)
            {
                return;
            }
            var deleted = record.Deleted;

            record.Status = RecordStatus.Last;
            if (deleted)
            {
                record.Status |= RecordStatus.LogicallyDeleted;
            }
            if (!ifUpdate)
            {
                record.Status |= RecordStatus.NonActualized;
            }
            XrfRecord xrfRecord = Xrf.ReadRecord(record.Mfn);

            Mst.UpdateRecordStatus(record.Status, xrfRecord.Offset);
            xrfRecord.Status = RecordStatus.AllZero;
            if (deleted)
            {
                xrfRecord.Status |= RecordStatus.LogicallyDeleted;
            }
            //оставить блокировку
            if (keepLock)
            {
                xrfRecord.Status |= RecordStatus.Locked;
            }
            //не было актуализации
            if (!ifUpdate)
            {
                xrfRecord.Status |= RecordStatus.NonActualized;
            }

            Xrf.WriteRecord(xrfRecord, padding);
            //в записи MST пишутся одни флаги, в XRF - другие
            //в результирующей записи нужно иметь комбинированный статус
            record.Status |= xrfRecord.Status;
        }
        public IrbisRecord ReadRecord
        (
            int mfn
        )
        {
            XrfRecord32 xrfRecord = Xrf.ReadRecord(mfn);

            if ((xrfRecord.Status & RecordStatus.PhysicallyDeleted) != 0)
            {
                return(null);
            }

            MstRecord32 mstRecord = Mst.ReadRecord2
                                    (
                xrfRecord.AbsoluteOffset
                                    );
            IrbisRecord result = mstRecord.DecodeRecord();

            result.Database = Database;

            return(result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ibatrak проверка записи
        /// </summary>
        private XrfRecord GetXrfRecordError(int mfn, RecordStatus status)
        {
            //при вызове GetMaxMfn перечитывается контрольная запись
            if (mfn <= 0 || mfn > GetMaxMfn())
            {
                OnIrbis64Code(-140 /*READ_WRONG_MFN*/);
                return(null);
            }
            XrfRecord xrfRecord = null;

            try
            {
                xrfRecord = Xrf.ReadRecord(mfn);
            }
            catch (ArgumentOutOfRangeException)
            {
                OnIrbis64Code(-140 /*READ_WRONG_MFN*/);
                return(null);
            }
            if ((xrfRecord.Status & RecordStatus.LogicallyDeleted & status) != 0)
            {
                OnIrbis64Code(-600 /*REC_DELETE*/);
                return(xrfRecord);
            }
            if ((xrfRecord.Status & (RecordStatus.PhysicallyDeleted | RecordStatus.Absent) & status) != 0)
            {
                OnIrbis64Code(-601 /*REC_PHYS_DELETE*/);
                return(xrfRecord);
            }
            if ((xrfRecord.Status & RecordStatus.Locked & status) != 0)
            {
                OnIrbis64Code(-602 /*ERR_RECLOCKED*/);
                return(xrfRecord);
            }
            OnIrbis64Code(0);
            return(xrfRecord);
        }