示例#1
0
        private Bindings(int count) {
            _count = count;

             _dbbindings = new tagDBBINDING[count];
            for(int i = 0;i < _dbbindings.Length;++i) {
                _dbbindings[i] = new tagDBBINDING();
            }
            _dbcolumns = new tagDBCOLUMNACCESS[count];
        }
示例#2
0
        private Bindings(int count)
        {
            _count = count;

            _dbbindings = new tagDBBINDING[count];
            for (int i = 0; i < _dbbindings.Length; ++i)
            {
                _dbbindings[i] = new tagDBBINDING();
            }
            _dbcolumns = new tagDBCOLUMNACCESS[count];
        }
 internal ColumnBinding(OleDbDataReader dataReader, int index, int indexForAccessor, int indexWithinAccessor, OleDbParameter parameter, System.Data.OleDb.RowBinding rowbinding, System.Data.OleDb.Bindings bindings, tagDBBINDING binding, int offset, bool ifIRowsetElseIRow)
 {
     this._dataReader = dataReader;
     this._rowbinding = rowbinding;
     this._bindings = bindings;
     this._index = index;
     this._indexForAccessor = indexForAccessor;
     this._indexWithinAccessor = indexWithinAccessor;
     if (parameter != null)
     {
         this._parameter = parameter;
         this._parameterChangeID = parameter.ChangeID;
     }
     this._offsetStatus = binding.obStatus.ToInt32() + offset;
     this._offsetLength = binding.obLength.ToInt32() + offset;
     this._offsetValue = binding.obValue.ToInt32() + offset;
     this._ordinal = binding.iOrdinal.ToInt32();
     this._maxLen = binding.cbMaxLen.ToInt32();
     this._wType = binding.wType;
     this._precision = binding.bPrecision;
     this._ifIRowsetElseIRow = ifIRowsetElseIRow;
     this.SetSize(this.Bindings.ParamSize.ToInt32());
 }
示例#4
0
        internal ColumnBinding(OleDbDataReader dataReader, int index, int indexForAccessor, int indexWithinAccessor,
                                OleDbParameter parameter, RowBinding rowbinding, Bindings bindings, tagDBBINDING binding, int offset,
                                bool ifIRowsetElseIRow) {

            Debug.Assert(null != rowbinding, "null rowbinding");
            Debug.Assert(null != bindings, "null bindings");
            Debug.Assert(ODB.SizeOf_tagDBBINDING <= offset, "invalid offset" + offset);

            _dataReader = dataReader;
            _rowbinding = rowbinding;
            _bindings = bindings;
            _index = index;
            _indexForAccessor = indexForAccessor;
            _indexWithinAccessor = indexWithinAccessor;

            if (null != parameter) {
                _parameter = parameter;
                _parameterChangeID = parameter.ChangeID;
            }
            _offsetStatus = binding.obStatus.ToInt32() + offset;
            _offsetLength = binding.obLength.ToInt32() + offset;
            _offsetValue  = binding.obValue.ToInt32() + offset;

            Debug.Assert(0 <= _offsetStatus, "negative _offsetStatus");
            Debug.Assert(0 <= _offsetLength, "negative _offsetLength");
            Debug.Assert(0 <= _offsetValue,  "negative _offsetValue");

            _ordinal = binding.iOrdinal.ToInt32();
            _maxLen = binding.cbMaxLen.ToInt32();
            _wType = binding.wType;
            _precision = binding.bPrecision;

            _ifIRowsetElseIRow = ifIRowsetElseIRow;

            SetSize(Bindings.ParamSize.ToInt32());
        }
示例#5
0
        internal ColumnBinding[] SetBindings(OleDbDataReader dataReader, Bindings bindings,
                                             int indexStart, int indexForAccessor,
                                             OleDbParameter[] parameters, tagDBBINDING[] dbbindings, bool ifIRowsetElseIRow) {
            Debug.Assert(null != bindings, "null bindings");
            Debug.Assert(dbbindings.Length == BindingCount(), "count mismatch");

            bool mustRelease = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                DangerousAddRef(ref mustRelease);

                IntPtr buffer = DangerousGetHandle();
                for(int i = 0; i < dbbindings.Length; ++i) {
                    IntPtr ptr = ADP.IntPtrOffset(buffer, (i * ODB.SizeOf_tagDBBINDING));
                    Marshal.StructureToPtr(dbbindings[i], ptr, false/*deleteold*/);
                }
            }
            finally {
                if (mustRelease) {
                    DangerousRelease();
                }
            }

            ColumnBinding[] columns = new ColumnBinding[dbbindings.Length];
            for(int indexWithinAccessor = 0; indexWithinAccessor < columns.Length; ++indexWithinAccessor) {
                int index = indexStart + indexWithinAccessor;
                OleDbParameter parameter = ((null != parameters) ? parameters[index] : null);
                columns[indexWithinAccessor] = new ColumnBinding(
                    dataReader, index, indexForAccessor, indexWithinAccessor,
                    parameter, this, bindings, dbbindings[indexWithinAccessor], _headerLength,
                    ifIRowsetElseIRow);
            }
            return columns;
        }
 internal ColumnBinding[] SetBindings(OleDbDataReader dataReader, Bindings bindings, int indexStart, int indexForAccessor, OleDbParameter[] parameters, tagDBBINDING[] dbbindings, bool ifIRowsetElseIRow)
 {
     bool success = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         base.DangerousAddRef(ref success);
         IntPtr handle = base.DangerousGetHandle();
         for (int j = 0; j < dbbindings.Length; j++)
         {
             IntPtr ptr = ADP.IntPtrOffset(handle, j * ODB.SizeOf_tagDBBINDING);
             Marshal.StructureToPtr(dbbindings[j], ptr, false);
         }
     }
     finally
     {
         if (success)
         {
             base.DangerousRelease();
         }
     }
     ColumnBinding[] bindingArray = new ColumnBinding[dbbindings.Length];
     for (int i = 0; i < bindingArray.Length; i++)
     {
         int index = indexStart + i;
         OleDbParameter parameter = (parameters != null) ? parameters[index] : null;
         bindingArray[i] = new ColumnBinding(dataReader, index, indexForAccessor, i, parameter, this, bindings, dbbindings[i], this._headerLength, ifIRowsetElseIRow);
     }
     return bindingArray;
 }
示例#7
0
 internal ColumnBinding(OleDbDataReader dataReader, int index, int indexForAccessor, int indexWithinAccessor, OleDbParameter parameter, System.Data.OleDb.RowBinding rowbinding, System.Data.OleDb.Bindings bindings, tagDBBINDING binding, int offset, bool ifIRowsetElseIRow)
 {
     this._dataReader          = dataReader;
     this._rowbinding          = rowbinding;
     this._bindings            = bindings;
     this._index               = index;
     this._indexForAccessor    = indexForAccessor;
     this._indexWithinAccessor = indexWithinAccessor;
     if (parameter != null)
     {
         this._parameter         = parameter;
         this._parameterChangeID = parameter.ChangeID;
     }
     this._offsetStatus      = binding.obStatus.ToInt32() + offset;
     this._offsetLength      = binding.obLength.ToInt32() + offset;
     this._offsetValue       = binding.obValue.ToInt32() + offset;
     this._ordinal           = binding.iOrdinal.ToInt32();
     this._maxLen            = binding.cbMaxLen.ToInt32();
     this._wType             = binding.wType;
     this._precision         = binding.bPrecision;
     this._ifIRowsetElseIRow = ifIRowsetElseIRow;
     this.SetSize(this.Bindings.ParamSize.ToInt32());
 }