JET_COLUMNID iTypeSerializer.GetColumnId(EseCursorBase cur, string fName)
        {
            LookupColumnIDs(cur.idSession, cur.idTable);
            ColumnInfo col;

            if (!m_dictColumns.TryGetValue(fName, out col))
            {
                throw new ArgumentException("The column with the specified name was not found", "fName");
            }
            return(col.idColumn);
        }
 void iTypeSerializer.Deserialize(EseCursorBase cur, object rec)
 {
     LookupColumnIDs(cur.idSession, cur.idTable);
     foreach (var col in m_columns)
     {
         if (col.isObsolete)
         {
             continue;
         }
         col.DeSerialize(cur, rec);
     }
 }
Exemple #3
0
        protected SearchFilterBase(EseCursorBase _cur, string _index)
        {
            cur     = _cur;
            indName = _index;
            if (String.IsNullOrEmpty(indName))
            {
                throw new ArgumentException("No index is specified. " +
                                            "To cancel filtering, use Recordset.filterClear() method instead.");
            }

            indColumns = cur.serializer.getIndexedColumns(indName);
        }
        void iTypeSerializer.SaveSingleField(EseCursorBase cur, string fName, object value)
        {
            LookupColumnIDs(cur.idSession, cur.idTable);

            ColumnInfo col;

            if (!m_dictColumns.TryGetValue(fName, out col))
            {
                throw new ArgumentException("The column with the specified name was not found", "fName");
            }

            col.SerializeSingleField(cur, value);
        }
Exemple #5
0
        public SearchFilterBetween(EseCursorBase _cur, string _index, object[] _start, object[] _end)
            : base(_cur, _index)
        {
            valsStart = _start;
            valsEnd   = _end;

            lenStart = (null == valsStart) ? 0 : valsStart.Length;
            lenEnd   = (null == valsEnd) ? 0 : valsEnd.Length;

            if (lenStart > indColumns.Length || lenEnd > indColumns.Length)
            {
                throw new IndexOutOfRangeException("Index '" + indName + "' does not contain that many columns.");
            }
        }
        void iTypeSerializer.Serialize(EseCursorBase cur, object rec, bool bNewRecord)
        {
            LookupColumnIDs(cur.idSession, cur.idTable);

            foreach (var col in m_columns)
            {
                if (col.isObsolete)
                {
                    continue;
                }
                col.Serialize(cur, rec, bNewRecord);
                onColumnSerialized(cur, rec, bNewRecord, col);
            }
        }
        // Perform some special cases processing just after a column value has been serialized.
        void onColumnSerialized(EseCursorBase cur, object rec, bool bNewRecord, ColumnInfo col)
        {
            // If this is auto-incremented column, and we're adding the new record,
            // then we set the column value ASAP.
            if (bNewRecord && (col.attrib is Attributes.EseAutoIdAttribute))
            {
                col.RefreshAutoincValue(cur, rec);
            }

            // If this is [EseBinaryStream],
            // immediately fetch the bookmark and store it in the EseStreamValue instance, to allow access to stream data ASAP.
            // if( col.attrib is Attributes.EseBinaryStreamAttribute )
            //	col.DeSerialize( cur, rec );
        }
Exemple #8
0
            /// <summary>Retrieve an auto-increment column value</summary>
            /// <param name="cur">The table cursor.</param>
            /// <param name="rec">The object.</param>
            /// <seealso href="http://managedesent.codeplex.com/wikipage?title=HowDoI" />
            public void RefreshAutoincValue(EseCursorBase cur, object rec)
            {
                var aia = attrib as Attributes.EseAutoIdAttribute;

                if (null != aia)
                {
                    object val = aia.RetrieveCopy(cur, idColumn);
                    if (null != val)
                    {
                        setValue(rec, val);
                    }
                    return;
                }

                throw new NotSupportedException("RefreshAutoincValue method is only supported for AutoID columns.");
            }
Exemple #9
0
        public SearchFilterSubstring(EseCursorBase _cur, string _index, params object[] _vals)
            : base(_cur, _index, _vals)
        {
            // TODO [low]: only check for the first time this filter is constructed.
            var endColType = indColumns[vals.Length - 1].getColumnDef().coltyp;

            switch (endColType)
            {
            case JET_coltyp.Binary:
            case JET_coltyp.Text:
            case JET_coltyp.LongBinary:
            case JET_coltyp.LongText:
                break;

            default:
                throw new NotSupportedException("Substring search filter can only be used" +
                                                " when the key column is a text column or a variable binary column.");
            }
        }
Exemple #10
0
        public SearchFilterEqual(EseCursorBase _cur, string _index, params object[] _vals)
            : base(_cur, _index)
        {
            // Handle the null issue this way
            if (null == _vals)
            {
                vals = new object[1] {
                    null
                }
            }
            ;
            else
            {
                vals = _vals;
            }

            if (vals.Length > indColumns.Length)
            {
                throw new IndexOutOfRangeException("Index '" + indName + "' does not contain that many columns.");
            }
        }
Exemple #11
0
 // Construct as "All records in a secondary index"
 public FilterAllRecords(EseCursorBase _cur, string _index)
 {
     cur     = _cur;
     indName = _index;
 }
Exemple #12
0
            /// <summary>Get the value from the DB, and put it to the object.</summary>
            /// <param name="cur">The table cursor.</param>
            /// <param name="rec">The record object.</param>
            public void DeSerialize(EseCursorBase cur, object rec)
            {
                object val = DeSerialize(cur);

                setValue(rec, val);
            }
Exemple #13
0
 /// <summary>Just get the value from the DB, and return.</summary>
 /// <param name="cur">The table cursor.</param>
 /// <returns>Column value for the current record of the cursor.</returns>
 public object DeSerialize(EseCursorBase cur)
 {
     return(attrib.Deserialize(cur, idColumn));
 }
Exemple #14
0
 /// <summary>Update a single columt in the DB.</summary>
 /// <param name="cur">The table cursor.</param>
 /// <param name="value">The new value for the column.</param>
 public void SerializeSingleField(EseCursorBase cur, object value)
 {
     attrib.Serialize(cur, idColumn, value, false);
 }
Exemple #15
0
 public SearchFilterEqualInv(EseCursorBase _cur, string _index, params object[] _vals)
     : base(_cur, _index, _vals)
 {
 }
Exemple #16
0
 public SearchFilterBetweenInv(EseCursorBase _cur, string _index, object[] _start, object[] _end) :
     base(_cur, _index, _start, _end)
 {
 }
Exemple #17
0
 // Construct as "All records in the clustered index"
 public FilterAllRecords(EseCursorBase _cur)
 {
     cur     = _cur;
     indName = null;
 }
 public ImportExportTSV(EseCursorBase cur) : base(cur)
 {
 }
Exemple #19
0
 /// <summary>Get the value from object, store it in the DB.</summary>
 /// <param name="cur">The table cursor.</param>
 /// <param name="rec">The object.</param>
 /// <param name="bNewRecord">True for INSERT operations, false for UPDATE operations.</param>
 public void Serialize(EseCursorBase cur, object rec, bool bNewRecord)
 {
     attrib.Serialize(cur, idColumn, getValue(rec), bNewRecord);
 }
Exemple #20
0
 /// <summary>Construct the object</summary>
 /// <param name="cur">Cursor</param>
 /// <param name="idColumn">Column ID</param>
 public ColumnStreamWithPulse(EseCursorBase cur, JET_COLUMNID idColumn) : base(cur.idSession, cur.idTable, idColumn)
 {
     this.session = cur.session;
 }
Exemple #21
0
 protected ImportExport(EseCursorBase cur) :
     this(cur.session, cur.idTable, cur.serializer)
 {
 }