本文整理汇总了C#中JET_DBID类的典型用法代码示例。如果您正苦于以下问题:C# JET_DBID类的具体用法?C# JET_DBID怎么用?C# JET_DBID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JET_DBID类属于命名空间,在下文中一共展示了JET_DBID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIndexingEtagsTable
private static void CreateIndexingEtagsTable(JET_DBID dbid, JET_SESID session)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, "indexes_etag", 16, 100, out tableid);
JET_COLUMNID columnid;
Api.JetAddColumn(session, tableid, "key", new JET_COLUMNDEF
{
cbMax = 255,
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnTagged
}, null, 0, out columnid);
var defaultValue = BitConverter.GetBytes(0);
Api.JetAddColumn(session, tableid, "touches", new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnEscrowUpdate
}, defaultValue, defaultValue.Length, out columnid);
const string indexDef = "+key\0\0";
Api.JetCreateIndex(session, tableid, "by_key", CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length,
100);
}
示例2: Create
public override void Create(JET_SESID sessionId, JET_DBID databaseId)
{
var idColumnCreate = CreateAutoIncrementIdColumn(IdColumnName);
var identifierColumnCreate = CreateTextColumn(IdentifierColumnName);
var columns = new JET_COLUMNCREATE[] { idColumnCreate, identifierColumnCreate };
var primaryIndexKey = CreateIndexKey(IdColumnName);
var identifierIndexKey = CreateIndexKey(IdentifierColumnName);
var indexes = new JET_INDEXCREATE[]
{
CreatePrimaryIndex(primaryIndexKey),
CreateUniqueTextIndex(IdentifierIndexName, identifierIndexKey)
};
var tableCreate = CreateTable(TableName, columns, indexes);
Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate);
_idColumnId = idColumnCreate.columnid;
_identifierColumnId = identifierColumnCreate.columnid;
Api.JetCloseTable(sessionId, tableCreate.tableid);
}
示例3: CreateTable
internal static void CreateTable(Session session, JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, ifcHeaderTableName, 1, 100, out tableid);
using (var transaction = new Microsoft.Isam.Esent.Interop.Transaction(session))
{
JET_COLUMNID columnid;
var columndef = new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnAutoincrement
};
Api.JetAddColumn(session, tableid, _colNameHeaderId, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.Currency;
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
Api.JetAddColumn(session, tableid, _colNameEntityCount, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.LongBinary;
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
Api.JetAddColumn(session, tableid, _colNameHeaderData, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.Text;
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
columndef.cbMax = 32;
Api.JetAddColumn(session, tableid, _colNameFileVersion, columndef, null, 0, out columnid);
transaction.Commit(CommitTransactionGrbit.LazyFlush);
}
}
示例4: CreateTable
internal static void CreateTable(JET_SESID sesid, JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(sesid, dbid, GeometryTableName, 8, 80, out tableid);
using (var transaction = new Microsoft.Isam.Esent.Interop.Transaction(sesid))
{
JET_COLUMNID columnid;
var columndef = new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnAutoincrement
};
Api.JetAddColumn(sesid, tableid, colNameGeometryLabel, columndef, null, 0, out columnid);
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
Api.JetAddColumn(sesid, tableid, colNameProductLabel, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.UnsignedByte;
Api.JetAddColumn(sesid, tableid, colNameGeomType, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.Short;
Api.JetAddColumn(sesid, tableid, colNameProductIfcTypeId, columndef, null, 0, out columnid);
Api.JetAddColumn(sesid, tableid, colNameSubPart, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.Binary;
columndef.grbit = ColumndefGrbit.ColumnMaybeNull;
Api.JetAddColumn(sesid, tableid, colNameTransformMatrix, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.LongBinary;
//if (EsentVersion.SupportsWindows7Features)
// columndef.grbit |= Windows7Grbits.ColumnCompressed;
Api.JetAddColumn(sesid, tableid, colNameShapeData, columndef, null, 0, out columnid);
columndef.coltyp = JET_coltyp.Long;
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
Api.JetAddColumn(sesid, tableid, colNameGeometryHash, columndef, null, 0, out columnid);
columndef.grbit = ColumndefGrbit.ColumnNotNULL;
Api.JetAddColumn(sesid, tableid, colNameStyleLabel, columndef, null, 0, out columnid);
// The primary index is the type and the entity label.
string indexDef = string.Format("+{0}\0\0", colNameGeometryLabel);
Api.JetCreateIndex(sesid, tableid, geometryTablePrimaryIndex, CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length, 100);
//create index by geometry hashes
indexDef = string.Format("+{0}\0\0", colNameGeometryHash);
Api.JetCreateIndex(sesid, tableid, geometryTableHashIndex, CreateIndexGrbit.IndexDisallowNull, indexDef, indexDef.Length, 100);
//Create index by product
indexDef = string.Format("+{0}\0{1}\0{2}\0{3}\0{4}\0\0", colNameGeomType, colNameProductIfcTypeId, colNameProductLabel, colNameSubPart, colNameStyleLabel);
Api.JetCreateIndex(sesid, tableid, geometryTableGeomTypeIndex, CreateIndexGrbit.IndexUnique, indexDef, indexDef.Length, 100);
//create index by style
indexDef = string.Format("+{0}\0{1}\0{2}\0{3}\0{4}\0\0", colNameGeomType, colNameStyleLabel, colNameProductIfcTypeId, colNameProductLabel, colNameGeometryLabel);
Api.JetCreateIndex(sesid, tableid, geometryTableStyleIndex, CreateIndexGrbit.None, indexDef, indexDef.Length, 100);
Api.JetCloseTable(sesid, tableid);
transaction.Commit(CommitTransactionGrbit.LazyFlush);
}
}
示例5: Update
public void Update(Session session, JET_DBID dbid, Action<string> output)
{
using (var tbl = new Table(session, dbid, "tasks", OpenTableGrbit.None))
{
int rows = 0;
if (Api.TryMoveFirst(session, tbl))
{
var taskTypeColumnId = Api.GetTableColumnid(session, tbl, "task_type");
do
{
using (var update = new Update(session, tbl, JET_prep.Replace))
{
var taskType = Api.RetrieveColumnAsString(session, tbl, taskTypeColumnId, Encoding.Unicode);
Api.SetColumn(session, tbl, taskTypeColumnId, taskType, Encoding.ASCII);
update.Save();
}
if (rows++ % 10000 == 0)
{
output("Processed " + (rows) + " rows in tasks");
Api.JetCommitTransaction(session, CommitTransactionGrbit.LazyFlush);
Api.JetBeginTransaction2(session, BeginTransactionGrbit.None);
}
} while (Api.TryMoveNext(session, tbl));
}
SchemaCreator.UpdateVersion(session, dbid, "5.3");
}
}
示例6: Create
public void Create(JET_SESID session, JET_DBID dbid)
{
using (var tran = new Transaction(session))
{
JET_TABLEID tblID;
Api.JetCreateTable(session, dbid, tableName, 1, 80, out tblID);
JET_COLUMNID c;
Api.JetAddColumn(session, tblID, colName_ID, new JET_COLUMNDEF()
{
coltyp = JET_coltyp.Currency,
grbit = ColumndefGrbit.ColumnAutoincrement | ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL,
}, null, 0, out c);
Api.JetAddColumn(session, tblID, colName_LogID, new JET_COLUMNDEF()
{
coltyp = JET_coltyp.Currency,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL,
}, null, 0, out c);
var indexDef = "+" + colName_ID + "\0\0";
Api.JetCreateIndex(session, tblID, idxName_Primary, CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length, 80);
tran.Commit(CommitTransactionGrbit.None);
}
}
示例7: Update
public void Update(Session session, JET_DBID dbid)
{
using (var tx = new Transaction(session))
{
using (var files = new Table(session, dbid, "files", OpenTableGrbit.None))
{
const string indexDef = "+etag\0\0";
Api.JetCreateIndex(session, files, "by_etag", CreateIndexGrbit.IndexDisallowNull, indexDef, indexDef.Length,
100);
using (var details = new Table(session, dbid, "details", OpenTableGrbit.None))
{
Api.JetMove(session, details, JET_Move.First, MoveGrbit.None);
var columnids = Api.GetColumnDictionary(session, details);
using (var update = new Update(session, details, JET_prep.Replace))
{
Api.SetColumn(session, details, columnids["schema_version"], "2.7", Encoding.Unicode);
update.Save();
}
}
}
tx.Commit(CommitTransactionGrbit.None);
}
}
示例8: Update
public void Update(Session session, JET_DBID dbid, Action<string> output)
{
using (var tbl = new Table(session, dbid, "lists", OpenTableGrbit.None))
{
JET_COLUMNID columnid;
Api.JetAddColumn(session, tbl, "created_at", new JET_COLUMNDEF
{
coltyp = JET_coltyp.DateTime,
grbit = ColumndefGrbit.ColumnMaybeNull,
}, null, 0, out columnid);
if (Api.TryMoveFirst(session, tbl))
{
do
{
using (var update = new Update(session, tbl, JET_prep.Replace))
{
var createdAt = Api.GetTableColumnid(session, tbl, "created_at");
Api.SetColumn(session, tbl, createdAt, SystemTime.UtcNow);
update.Save();
}
} while (Api.TryMoveNext(session, tbl));
}
SchemaCreator.CreateIndexes(session, tbl, new JET_INDEXCREATE
{
szIndexName = "by_name_and_created_at",
szKey = "+name\0+created_at\0\0",
grbit = CreateIndexGrbit.IndexDisallowNull
});
SchemaCreator.UpdateVersion(session, dbid, "5.1");
}
}
示例9: CreateKeysTable
private void CreateKeysTable(JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, "keys", 16, 100, out tableid);
JET_COLUMNID columnid;
Api.JetAddColumn(session, tableid, "key", new JET_COLUMNDEF
{
cbMax = 255,
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
Api.JetAddColumn(session, tableid, "version", new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnAutoincrement
}, null, 0, out columnid);
var indexDef = "+key\0+version\0\0";
Api.JetCreateIndex(session, tableid, "pk", CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length,
100);
indexDef = "+key\0\0";
Api.JetCreateIndex(session, tableid, "by_key", CreateIndexGrbit.IndexDisallowNull, indexDef, indexDef.Length,
100);
}
示例10: CreateGlobalsTable
private static void CreateGlobalsTable(JET_DBID utxoDbId, Session jetSession)
{
JET_TABLEID globalsTableId;
JET_COLUMNID chainTipColumnId;
JET_COLUMNID unspentTxCountColumnId;
JET_COLUMNID unspentOutputCountColumnId;
JET_COLUMNID totalTxCountColumnId;
JET_COLUMNID totalInputCountColumnId;
JET_COLUMNID totalOutputCountColumnId;
Api.JetCreateTable(jetSession, utxoDbId, "Globals", 0, 0, out globalsTableId);
Api.JetAddColumn(jetSession, globalsTableId, "ChainTip", new JET_COLUMNDEF { coltyp = JET_coltyp.Binary }, null, 0, out chainTipColumnId);
Api.JetAddColumn(jetSession, globalsTableId, "UnspentTxCount", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out unspentTxCountColumnId);
Api.JetAddColumn(jetSession, globalsTableId, "UnspentOutputCount", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out unspentOutputCountColumnId);
Api.JetAddColumn(jetSession, globalsTableId, "TotalTxCount", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out totalTxCountColumnId);
Api.JetAddColumn(jetSession, globalsTableId, "TotalInputCount", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out totalInputCountColumnId);
Api.JetAddColumn(jetSession, globalsTableId, "TotalOutputCount", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out totalOutputCountColumnId);
// initialize global data
using (var jetUpdate = jetSession.BeginUpdate(globalsTableId, JET_prep.Insert))
{
Api.SetColumn(jetSession, globalsTableId, unspentTxCountColumnId, 0);
Api.SetColumn(jetSession, globalsTableId, unspentOutputCountColumnId, 0);
Api.SetColumn(jetSession, globalsTableId, totalTxCountColumnId, 0);
Api.SetColumn(jetSession, globalsTableId, totalInputCountColumnId, 0);
Api.SetColumn(jetSession, globalsTableId, totalOutputCountColumnId, 0);
jetUpdate.Save();
}
Api.JetCloseTable(jetSession, globalsTableId);
}
示例11: CreateDetailsTable
private void CreateDetailsTable(JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, "details", 16, 100, out tableid);
JET_COLUMNID id;
Api.JetAddColumn(session, tableid, "id", new JET_COLUMNDEF
{
cbMax = 16,
coltyp = JET_coltyp.Binary,
grbit = ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnFixed
}, null, 0, out id);
JET_COLUMNID schemaVersion;
Api.JetAddColumn(session, tableid, "schema_version", new JET_COLUMNDEF
{
cbMax = Encoding.Unicode.GetByteCount(SchemaVersion),
cp = JET_CP.Unicode,
coltyp = JET_coltyp.Text,
grbit = ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnFixed
}, null, 0, out schemaVersion);
using (var update = new Update(session, tableid, JET_prep.Insert))
{
Api.SetColumn(session, tableid, id, Guid.NewGuid().ToByteArray());
Api.SetColumn(session, tableid, schemaVersion, SchemaVersion, Encoding.Unicode);
update.Save();
}
}
示例12: Table
/// <summary>
/// Initializes a new instance of the Table class. The table is
/// opened from the given database.
/// </summary>
/// <param name="sesid">The session to use.</param>
/// <param name="dbid">The database to open the table in.</param>
/// <param name="name">The name of the table.</param>
/// <param name="grbit">JetOpenTable options.</param>
public Table(JET_SESID sesid, JET_DBID dbid, string name, OpenTableGrbit grbit)
{
this.sesid = sesid;
this.name = name;
Api.JetOpenTable(this.sesid, dbid, this.name, null, 0, grbit, out this.tableid);
this.ResourceWasAllocated();
}
示例13: Update
public void Update(Session session, JET_DBID dbid)
{
using (var tx = new Transaction(session))
{
using (var tasks = new Table(session, dbid, "tasks", OpenTableGrbit.None))
{
JET_COLUMNID columnid;
Api.JetAddColumn(session, tasks, "added_at",new JET_COLUMNDEF
{
coltyp = JET_coltyp.DateTime,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
using (var details = new Table(session, dbid, "details", OpenTableGrbit.None))
{
Api.JetMove(session, details, JET_Move.First, MoveGrbit.None);
var columnids = Api.GetColumnDictionary(session, details);
using (var update = new Update(session, details, JET_prep.Replace))
{
Api.SetColumn(session, details, columnids["schema_version"], "2.5", Encoding.Unicode);
update.Save();
}
}
}
tx.Commit(CommitTransactionGrbit.None);
}
}
示例14: CreateIdentityTable
private void CreateIdentityTable(JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, "identity_table", 1, 80, out tableid);
JET_COLUMNID columnid;
Api.JetAddColumn(session, tableid, "key", new JET_COLUMNDEF
{
cbMax = 255,
coltyp = JET_coltyp.Text,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnTagged
}, null, 0, out columnid);
var defaultValue = BitConverter.GetBytes(0);
Api.JetAddColumn(session, tableid, "val", new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnEscrowUpdate | ColumndefGrbit.ColumnNotNULL
}, defaultValue, defaultValue.Length, out columnid);
const string indexDef = "+key\0\0";
Api.JetCreateIndex(session, tableid, "by_key", CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length,
80);
}
示例15: CreateIdentityTable
private void CreateIdentityTable(JET_DBID dbid)
{
JET_TABLEID tableid;
Api.JetCreateTable(session, dbid, "identity_table", 1, 80, out tableid);
JET_COLUMNID columnid;
Api.JetAddColumn(session, tableid, "key", new JET_COLUMNDEF
{
cbMax = 2048,
coltyp = JET_coltyp.LongText,
cp = JET_CP.Unicode,
grbit = ColumnNotNullIfOnHigherThanWindowsXp()
}, null, 0, out columnid);
var defaultValue = BitConverter.GetBytes(0);
Api.JetAddColumn(session, tableid, "val", new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnEscrowUpdate | ColumndefGrbit.ColumnNotNULL
}, defaultValue, defaultValue.Length, out columnid);
CreateIndexes(tableid, new JET_INDEXCREATE
{
szKey = "+key\0\0",
szIndexName = "by_key",
grbit = CreateIndexGrbit.IndexPrimary
});
}