internal unsafe int SetColumns( JET_SESID sesid, JET_TABLEID tableid, ColumnValue[] columnValues, NATIVE_SETCOLUMN *nativeColumns, int i, void *buffer, int bufferSize, bool hasValue) { Debug.Assert(this == columnValues[i], "SetColumns should be called on the current object"); NATIVE_SETCOLUMN setcolumn = this.MakeNativeSetColumn(); if (hasValue) { setcolumn.cbData = checked ((uint)bufferSize); setcolumn.pvData = new IntPtr(buffer); if (0 == bufferSize) { setcolumn.grbit |= (uint)SetColumnGrbit.ZeroLength; } } nativeColumns[i] = setcolumn; int err = i == columnValues.Length - 1 ? Api.Impl.JetSetColumns(sesid, tableid, nativeColumns, columnValues.Length) : columnValues[i + 1].SetColumns(sesid, tableid, columnValues, nativeColumns, i + 1); this.Error = (JET_err)nativeColumns[i].err; return(err); }
public void Setup() { this.managed = new JET_SETCOLUMN { cbData = 1, columnid = new JET_COLUMNID { Value = 2 }, grbit = SetColumnGrbit.AppendLV, ibLongValue = 3, itagSequence = 4, }; this.native = this.managed.GetNativeSetcolumn(); }
/// <summary> /// Gets the NATIVE_SETCOLUMN structure that represents the object. /// </summary> /// <returns>A NATIVE_SETCOLUMN structure whose fields match the class.</returns> internal NATIVE_SETCOLUMN GetNativeSetcolumn() { var setinfo = new NATIVE_SETCOLUMN { columnid = this.columnid.Value, cbData = checked ((uint)this.cbData), grbit = (uint)this.grbit, ibLongValue = checked ((uint)this.ibLongValue), itagSequence = checked ((uint)this.itagSequence), }; return(setinfo); }
/// <summary> /// Recursive SetColumns method for data pinning. This populates the buffer and /// calls the inherited SetColumns method. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid"> /// The table to set the columns in. An update should be prepared. /// </param> /// <param name="columnValues"> /// Column values to set. /// </param> /// <param name="nativeColumns"> /// Structures to put the pinned data in. /// </param> /// <param name="i">Offset of this object in the array.</param> /// <returns>An error code.</returns> internal unsafe override int SetColumns(JET_SESID sesid, JET_TABLEID tableid, ColumnValue[] columnValues, NATIVE_SETCOLUMN* nativeColumns, int i) { if (null != this.Value) { fixed (void* buffer = this.Value) { return this.SetColumns( sesid, tableid, columnValues, nativeColumns, i, buffer, this.Value.Length, true); } } return this.SetColumns(sesid, tableid, columnValues, nativeColumns, i, null, 0, false); }
/// <summary> /// Create a native SetColumn from this object. /// </summary> /// <param name="setcolumn">The native setcolumn structure to fill in.</param> private void MakeNativeSetColumn(ref NATIVE_SETCOLUMN setcolumn) { setcolumn.columnid = this.Columnid.Value; setcolumn.grbit = (uint)this.SetGrbit; setcolumn.itagSequence = checked((uint)this.ItagSequence); }
/// <summary> /// Recursive SetColumns function used to pin data. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid"> /// The table to set the columns in. An update should be prepared. /// </param> /// <param name="columnValues"> /// Column values to set. /// </param> /// <param name="nativeColumns"> /// Structures to put the pinned data in. /// </param> /// <param name="i">Offset of this object in the array.</param> /// <param name="buffer">The buffer for this object.</param> /// <param name="bufferSize">Size of the buffer for ths object.</param> /// <param name="hasValue">True if this object is non null.</param> /// <returns>An error code.</returns> /// <remarks> /// This is marked as internal because it uses the NATIVE_SETCOLUMN type /// which is also marked as internal. It should be treated as a protected /// method though. /// </remarks> internal unsafe int SetColumns( JET_SESID sesid, JET_TABLEID tableid, ColumnValue[] columnValues, NATIVE_SETCOLUMN* nativeColumns, int i, void* buffer, int bufferSize, bool hasValue) { Debug.Assert(this == columnValues[i], "SetColumns should be called on the current object"); this.MakeNativeSetColumn(ref nativeColumns[i]); if (hasValue) { nativeColumns[i].cbData = checked((uint)bufferSize); nativeColumns[i].pvData = new IntPtr(buffer); if (0 == bufferSize) { nativeColumns[i].grbit |= (uint)SetColumnGrbit.ZeroLength; } } int err = i == columnValues.Length - 1 ? Api.Impl.JetSetColumns(sesid, tableid, nativeColumns, columnValues.Length) : columnValues[i + 1].SetColumns(sesid, tableid, columnValues, nativeColumns, i + 1); this.Error = (JET_wrn)nativeColumns[i].err; return err; }
/// <summary> /// Recursive SetColumns method for data pinning. This should populate the buffer and /// call the inherited SetColumns method. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid"> /// The table to set the columns in. An update should be prepared. /// </param> /// <param name="columnValues"> /// Column values to set. /// </param> /// <param name="nativeColumns"> /// Structures to put the pinned data in. /// </param> /// <param name="i">Offset of this object in the array.</param> /// <returns>An error code.</returns> internal abstract unsafe int SetColumns(JET_SESID sesid, JET_TABLEID tableid, ColumnValue[] columnValues, NATIVE_SETCOLUMN* nativeColumns, int i);
/// <summary> /// Gets the NATIVE_SETCOLUMN structure that represents the object. /// </summary> /// <returns>A NATIVE_SETCOLUMN structure whose fields match the class.</returns> internal NATIVE_SETCOLUMN GetNativeSetcolumn() { var setinfo = new NATIVE_SETCOLUMN { columnid = this.columnid.Value, cbData = checked((uint) this.cbData), grbit = (uint) this.grbit, ibLongValue = checked((uint) this.ibLongValue), itagSequence = checked((uint) this.itagSequence), }; return setinfo; }
/// <summary> /// Create a native SetColumn from this object. /// </summary> /// <param name="setcolumn">The native setcolumn structure to fill in.</param> private void MakeNativeSetColumn(ref NATIVE_SETCOLUMN setcolumn) { setcolumn.columnid = this.Columnid.Value; setcolumn.grbit = (uint)this.SetGrbit; setcolumn.itagSequence = checked ((uint)this.ItagSequence); }