本文整理汇总了C#中JET_TABLEID类的典型用法代码示例。如果您正苦于以下问题:C# JET_TABLEID类的具体用法?C# JET_TABLEID怎么用?C# JET_TABLEID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JET_TABLEID类属于命名空间,在下文中一共展示了JET_TABLEID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
JET_TABLEID tableidTemp = new JET_TABLEID()
{
Value = (IntPtr)456,
};
this.managed = new JET_TABLECREATE()
{
szTableName = "table7",
szTemplateTableName = "parentTable",
ulPages = 7,
ulDensity = 62,
rgcolumncreate = null,
cColumns = 0,
rgindexcreate = null,
cIndexes = 0,
szCallback = "module!FunkyFunction",
cbtyp = JET_cbtyp.AfterReplace,
grbit = CreateTableColumnIndexGrbit.FixedDDL,
pSeqSpacehints = null,
pLVSpacehints = null,
cbSeparateLV = 0x999,
tableid = tableidTemp,
cCreated = 2,
};
this.native = this.managed.GetNativeTableCreate2();
}
示例2: CreateDocumentsTable
private static void CreateDocumentsTable(Session session, JET_TABLEID tableid)
{
JET_COLUMNID columnid;
var guidColumn = new JET_COLUMNDEF
{
cbMax = 255,
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnTagged
};
Api.JetAddColumn(session, tableid, "id", guidColumn, null, 0, out columnid);
var collectionColumn = new JET_COLUMNDEF
{
cbMax = 1000,
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnTagged
};
Api.JetAddColumn(session, tableid, "collection_name", collectionColumn, null, 0, out columnid);
const string colectionIndexDef = "+collection_name\0\0";
Api.JetCreateIndex(session, tableid, "by_collection_name", CreateIndexGrbit.None, colectionIndexDef, colectionIndexDef.Length, 100);
var textColumn = new JET_COLUMNDEF
{
coltyp = JET_coltyp.LongText,
grbit = ColumndefGrbit.ColumnTagged
};
Api.JetAddColumn(session, tableid, "data", textColumn, null, 0, out columnid);
const string idIndexDef = "+id\0\0";
Api.JetCreateIndex(session, tableid, "by_id", CreateIndexGrbit.IndexPrimary, idIndexDef, idIndexDef.Length, 100);
}
示例3: ConvertObjectlistFromNative
public void ConvertObjectlistFromNative()
{
var tableid = new JET_TABLEID { Value = (IntPtr)0x1000 };
var col1 = new JET_COLUMNID { Value = 1 };
var col2 = new JET_COLUMNID { Value = 2 };
var col3 = new JET_COLUMNID { Value = 3 };
var col4 = new JET_COLUMNID { Value = 4 };
var col5 = new JET_COLUMNID { Value = 5 };
var col6 = new JET_COLUMNID { Value = 6 };
var native = new NATIVE_OBJECTLIST()
{
tableid = tableid.Value,
cRecord = 100,
columnidobjectname = col1.Value,
columnidobjtyp = col2.Value,
columnidgrbit = col3.Value,
columnidflags = col4.Value,
columnidcRecord = col5.Value,
columnidcPage = col6.Value,
};
var objectlist = new JET_OBJECTLIST();
objectlist.SetFromNativeObjectlist(native);
Assert.AreEqual(tableid, objectlist.tableid);
Assert.AreEqual(100, objectlist.cRecord);
Assert.AreEqual(col1, objectlist.columnidobjectname);
Assert.AreEqual(col2, objectlist.columnidobjtyp);
Assert.AreEqual(col3, objectlist.columnidgrbit);
Assert.AreEqual(col4, objectlist.columnidflags);
Assert.AreEqual(col5, objectlist.columnidcRecord);
Assert.AreEqual(col6, objectlist.columnidcPage);
}
示例4: MakeKey
/// <summary>
/// Constructs a search key that may then be used by <see cref="JetSeek"/>
/// and <see cref="JetSetIndexRange"/>.
/// </summary>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The cursor to create the key on.</param>
/// <param name="data">Column data for the current key column of the current index.</param>
/// <param name="encoding">The encoding used to convert the string.</param>
/// <param name="grbit">Key options.</param>
public static void MakeKey(JET_SESID sesid, JET_TABLEID tableid, string data, Encoding encoding, MakeKeyGrbit grbit)
{
CheckEncodingIsValid(encoding);
if (null == data)
{
Api.JetMakeKey(sesid, tableid, null, 0, grbit);
}
else if (0 == data.Length)
{
Api.JetMakeKey(sesid, tableid, null, 0, grbit | MakeKeyGrbit.KeyDataZeroLength);
}
else if (Encoding.Unicode == encoding)
{
// Optimization for Unicode strings
unsafe
{
fixed (char* buffer = data)
{
Api.JetMakeKey(sesid, tableid, (IntPtr) buffer, data.Length * sizeof(char), grbit);
}
}
}
else
{
byte[] bytes = encoding.GetBytes(data);
Api.JetMakeKey(sesid, tableid, bytes, bytes.Length, grbit);
}
}
示例5: DoCreateTable
protected override void DoCreateTable(Session session, JET_TABLEID tableid)
{
JET_COLUMNID columnid;
Api.JetAddColumn(session, tableid, "FileId", new JET_COLUMNDEF()
{
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
cbMax = 255,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
Api.JetAddColumn(session, tableid, "Size", new JET_COLUMNDEF()
{
coltyp = Windows10Coltyp.UnsignedLongLong,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
Api.JetAddColumn(session, tableid, "DTicks", new JET_COLUMNDEF()
{
coltyp = VistaColtyp.LongLong,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
Api.JetAddColumn(session, tableid, "OTicks", new JET_COLUMNDEF()
{
coltyp = VistaColtyp.LongLong,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
var indexDef = "+FileId\0\0";
Api.JetCreateIndex(session, tableid, PrimaryIndexName, CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length, 100);
}
示例6: JetSetColumn
/// <summary>
/// The JetSetColumn function modifies a single column value in a modified record to be inserted or to
/// update the current record. It can overwrite an existing value, add a new value to a sequence of
/// values in a multi-valued column, remove a value from a sequence of values in a multi-valued column,
/// or update all or part of a long value (a column of type <see cref="JET_coltyp.LongText"/>
/// or <see cref="JET_coltyp.LongBinary"/>).
/// </summary>
/// <remarks>
/// This is an internal-only version of the API that takes a data buffer and an offset into the buffer.
/// </remarks>
/// <param name="sesid">The session which is performing the update.</param>
/// <param name="tableid">The cursor to update. An update should be prepared.</param>
/// <param name="columnid">The columnid to set.</param>
/// <param name="data">The data to set.</param>
/// <param name="dataSize">The size of data to set.</param>
/// <param name="dataOffset">The offset in the data buffer to set data from.</param>
/// <param name="grbit">SetColumn options.</param>
/// <param name="setinfo">Used to specify itag or long-value offset.</param>
/// <returns>A warning value.</returns>
public static JET_wrn JetSetColumn(JET_SESID sesid, JET_TABLEID tableid, JET_COLUMNID columnid, byte[] data, int dataSize, int dataOffset, SetColumnGrbit grbit, JET_SETINFO setinfo)
{
if (dataOffset < 0
|| (null != data && 0 != dataSize && dataOffset >= data.Length)
|| (null == data && dataOffset != 0))
{
throw new ArgumentOutOfRangeException(
"dataOffset",
dataOffset,
"must be inside the data buffer");
}
if (null != data && dataSize > checked(data.Length - dataOffset) && (SetColumnGrbit.SizeLV != (grbit & SetColumnGrbit.SizeLV)))
{
throw new ArgumentOutOfRangeException(
"dataSize",
dataSize,
"cannot be greater than the length of the data (unless the SizeLV option is used)");
}
unsafe
{
fixed (byte* pointer = data)
{
return Api.JetSetColumn(sesid, tableid, columnid, new IntPtr(pointer + dataOffset), dataSize, grbit, setinfo);
}
}
}
示例7: ColumnAccessor
/// <summary>
/// Initializes a new instance of the <see cref="ColumnAccessor" /> class.
/// </summary>
/// <param name="cursor">The cursor.</param>
/// <param name="isamSession">The session.</param>
/// <param name="tableid">The tableid.</param>
/// <param name="grbit">The grbit.</param>
internal ColumnAccessor(Cursor cursor, IsamSession isamSession, JET_TABLEID tableid, RetrieveColumnGrbit grbit)
{
this.cursor = cursor;
this.isamSession = isamSession;
this.tableid = tableid;
this.grbit = grbit;
}
示例8: JetRetrieveColumn
/// <summary>
/// Retrieves a single column value from the current record. The record is that
/// record associated with the index entry at the current position of the cursor.
/// Alternatively, this function can retrieve a column from a record being created
/// in the cursor copy buffer. This function can also retrieve column data from an
/// index entry that references the current record. In addition to retrieving the
/// actual column value, JetRetrieveColumn can also be used to retrieve the size
/// of a column, before retrieving the column data itself so that application
/// buffers can be sized appropriately.
/// </summary>
/// <remarks>
/// This is an internal method that takes a buffer offset as well as size.
/// </remarks>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The cursor to retrieve the column from.</param>
/// <param name="columnid">The columnid to retrieve.</param>
/// <param name="data">The data buffer to be retrieved into.</param>
/// <param name="dataSize">The size of the data buffer.</param>
/// <param name="dataOffset">Offset into the data buffer to read data into.</param>
/// <param name="actualDataSize">Returns the actual size of the data buffer.</param>
/// <param name="grbit">Retrieve column options.</param>
/// <param name="retinfo">
/// If pretinfo is give as NULL then the function behaves as though an itagSequence
/// of 1 and an ibLongValue of 0 (zero) were given. This causes column retrieval to
/// retrieve the first value of a multi-valued column, and to retrieve long data at
/// offset 0 (zero).
/// </param>
/// <returns>An ESENT warning code.</returns>
public static JET_wrn JetRetrieveColumn(JET_SESID sesid, JET_TABLEID tableid, JET_COLUMNID columnid, byte[] data, int dataSize, int dataOffset, out int actualDataSize, RetrieveColumnGrbit grbit, JET_RETINFO retinfo)
{
if (dataOffset < 0
|| (null != data && 0 != dataSize && dataOffset >= data.Length)
|| (null == data && dataOffset != 0))
{
throw new ArgumentOutOfRangeException(
"dataOffset",
dataOffset,
"must be inside the data buffer");
}
if ((null == data && dataSize > 0) || (null != data && dataSize > data.Length))
{
throw new ArgumentOutOfRangeException(
"dataSize",
dataSize,
"cannot be greater than the length of the data");
}
unsafe
{
fixed (byte* pointer = data)
{
return Api.JetRetrieveColumn(
sesid, tableid, columnid, new IntPtr(pointer + dataOffset), dataSize, out actualDataSize, grbit, retinfo);
}
}
}
示例9: Add
public bool Add(JET_SESID session, JET_TABLEID table, int level)
{
byte[] buffer;
int actualBookmarkSize;
var largeBuffer = IndexReaderBuffers.Buffers.TakeBuffer(bookmarkMost);
try
{
Api.JetGetBookmark(session, table, largeBuffer,
largeBuffer.Length, out actualBookmarkSize);
buffer = new byte[actualBookmarkSize];
Buffer.BlockCopy(largeBuffer, 0, buffer, 0, actualBookmarkSize);
}
finally
{
IndexReaderBuffers.Buffers.ReturnBuffer(largeBuffer);
}
var res = itemsToDelete.TryAdd(new Key(buffer, actualBookmarkSize));
if (res)
{
itemsToDeletePerViewAndLevel.DecrementPerLevelCounters(level);
}
return res;
}
示例10: MakeKey
/// <summary>
/// Constructs a search key that may then be used by <see cref="JetSeek"/>
/// and <see cref="JetSetIndexRange"/>.
/// </summary>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The cursor to create the key on.</param>
/// <param name="data">Column data for the current key column of the current index.</param>
/// <param name="encoding">The encoding used to convert the string.</param>
/// <param name="grbit">Key options.</param>
public static void MakeKey(JET_SESID sesid, JET_TABLEID tableid, string data, Encoding encoding, MakeKeyGrbit grbit)
{
CheckEncodingIsValid(encoding);
if (null == data)
{
Api.JetMakeKey(sesid, tableid, null, 0, grbit);
}
else if (0 == data.Length)
{
Api.JetMakeKey(sesid, tableid, null, 0, grbit | MakeKeyGrbit.KeyDataZeroLength);
}
else if (Encoding.Unicode == encoding)
{
// Optimization for Unicode strings
unsafe
{
fixed (char* buffer = data)
{
Api.JetMakeKey(sesid, tableid, new IntPtr(buffer), checked(data.Length * sizeof(char)), grbit);
}
}
}
else
{
#if MANAGEDESENT_ON_WSA
// Encoding.GetBytes(char*, int, byte*, int) overload is missing in new Windows UI.
// So we can't use the ColumnCache. We'll just use a different GetBytes() overload.
byte[] buffer = encoding.GetBytes(data);
Api.JetMakeKey(sesid, tableid, buffer, buffer.Length, grbit);
#else
// Convert the string using a cached column buffer. The column buffer is far larger
// than the maximum key size, so any data truncation here won't matter.
byte[] buffer = null;
try
{
buffer = Caches.ColumnCache.Allocate();
int dataSize;
unsafe
{
fixed (char* chars = data)
fixed (byte* bytes = buffer)
{
dataSize = encoding.GetBytes(chars, data.Length, bytes, buffer.Length);
}
}
JetMakeKey(sesid, tableid, buffer, dataSize, grbit);
}
finally
{
if (buffer != null)
{
Caches.ColumnCache.Free(ref buffer);
}
}
#endif
}
}
示例11: JetCreateIndex4
/// <summary>
/// Creates indexes over data in an ESE database.
/// </summary>
/// <remarks>
/// When creating multiple indexes (i.e. with numIndexCreates
/// greater than 1) this method MUST be called
/// outside of any transactions and with exclusive access to the
/// table. The JET_TABLEID returned by "Api.JetCreateTable"
/// will have exlusive access or the table can be opened for
/// exclusive access by passing <see cref="OpenTableGrbit.DenyRead"/>
/// to <see cref="Api.JetOpenTable"/>.
/// </remarks>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The table to create the index on.</param>
/// <param name="indexcreates">Array of objects describing the indexes to be created.</param>
/// <param name="numIndexCreates">Number of index description objects.</param>
public static void JetCreateIndex4(
JET_SESID sesid,
JET_TABLEID tableid,
JET_INDEXCREATE[] indexcreates,
int numIndexCreates)
{
Api.Check(Api.Impl.JetCreateIndex4(sesid, tableid, indexcreates, numIndexCreates));
}
示例12: ColumnStream
/// <summary>
/// Initializes a new instance of the ColumnStream class.
/// </summary>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The cursor to use.</param>
/// <param name="columnid">The columnid of the column to set/retrieve data from.</param>
public ColumnStream(JET_SESID sesid, JET_TABLEID tableid, JET_COLUMNID columnid)
{
this.sesid = sesid;
this.tableid = tableid;
this.columnid = columnid;
this.ibLongValue = 0;
this.Itag = 1;
}
示例13: JetGetTableColumnInfo
/// <summary>
/// Retrieves information about a table column.
/// </summary>
/// <param name="sesid">The session to use.</param>
/// <param name="tableid">The table containing the column.</param>
/// <param name="columnid">The columnid of the column.</param>
/// <param name="columnbase">Filled in with information about the column.</param>
public static void JetGetTableColumnInfo(
JET_SESID sesid,
JET_TABLEID tableid,
JET_COLUMNID columnid,
out JET_COLUMNBASE columnbase)
{
Api.Check(Api.Impl.JetGetTableColumnInfo(sesid, tableid, columnid, out columnbase));
}
示例14: JetGetTableIndexInfo
public static void JetGetTableIndexInfo(
JET_SESID sesid,
JET_TABLEID tableid,
string indexname,
out JET_INDEXLIST indexlist)
{
Api.JetGetTableIndexInfo(sesid, tableid, indexname, out indexlist, JET_IdxInfo.List);
}
示例15: TempTableHandle
/// <summary>
/// Initializes a new instance of the <see cref="TempTableHandle"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="sesid">The sesid.</param>
/// <param name="tableid">The tableid.</param>
/// <param name="inInsertMode">if set to <c>true</c> [in insert mode].</param>
internal TempTableHandle(string name, JET_SESID sesid, JET_TABLEID tableid, bool inInsertMode)
{
this.guid = Guid.NewGuid();
this.name = name;
this.sesid = sesid;
this.tableid = tableid;
this.inInsertMode = inInsertMode;
this.cursorCount = 0;
}