internal OleDbHResult CreateAccessor(UnsafeNativeMethods.IAccessor iaccessor, int flags, ColumnBinding[] bindings) { OleDbHResult result = OleDbHResult.S_OK; int[] rgStatus = new int[this.BindingCount()]; this._iaccessor = iaccessor; Bid.Trace("<oledb.IAccessor.CreateAccessor|API|OLEDB>\n"); result = iaccessor.CreateAccessor(flags, (IntPtr)rgStatus.Length, this, (IntPtr)this._dataLength, out this._accessorHandle, rgStatus); Bid.Trace("<oledb.IAccessor.CreateAccessor|API|OLEDB|RET> %08X{HRESULT}\n", result); for (int i = 0; i < rgStatus.Length; i++) { if (rgStatus[i] != 0) { if (4 == flags) { throw ODB.BadStatus_ParamAcc(bindings[i].ColumnBindingOrdinal, (DBBindStatus)rgStatus[i]); } if (2 == flags) { throw ODB.BadStatusRowAccessor(bindings[i].ColumnBindingOrdinal, (DBBindStatus)rgStatus[i]); } } } return(result); }
internal OleDbHResult CreateAccessor(UnsafeNativeMethods.IAccessor iaccessor, int flags, ColumnBinding[] bindings) { int[] rowBindStatus = new int[BindingCount()]; _iaccessor = iaccessor; OleDbHResult hr = iaccessor.CreateAccessor(flags, (IntPtr)rowBindStatus.Length, this, (IntPtr)_dataLength, out _accessorHandle, rowBindStatus); for (int k = 0; k < rowBindStatus.Length; ++k) { if (DBBindStatus.OK != (DBBindStatus)rowBindStatus[k]) { if (ODB.DBACCESSOR_PARAMETERDATA == flags) { throw ODB.BadStatus_ParamAcc(bindings[k].ColumnBindingOrdinal, (DBBindStatus)rowBindStatus[k]); } else if (ODB.DBACCESSOR_ROWDATA == flags) { throw ODB.BadStatusRowAccessor(bindings[k].ColumnBindingOrdinal, (DBBindStatus)rowBindStatus[k]); } else { Debug.Assert(false, "unknown accessor buffer"); } } } return(hr); }