本文整理汇总了C#中Microsoft.Isam.Esent.Interop.Table类的典型用法代码示例。如果您正苦于以下问题:C# Table类的具体用法?C# Table怎么用?C# Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于Microsoft.Isam.Esent.Interop命名空间,在下文中一共展示了Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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");
}
}
开发者ID:ricardobrandao,项目名称:ravendb,代码行数:29,代码来源:From52To53.cs
示例2: DumpTable
public static void DumpTable(Session session, Table table, Stream stream)
{
using (var writer = new StreamWriter(stream))
{
var cols = Api.GetTableColumns(session, table).ToArray();
foreach (var col in cols)
{
writer.Write(col);
writer.Write(",");
}
writer.WriteLine("#");
Api.MoveBeforeFirst(session, table);
int count = 0;
while (Api.TryMoveNext(session, table))
{
foreach (var col in cols)
{
var val = GetvalueFromTable(session, table, col) ?? "NULL";
writer.Write(val);
writer.Write(",");
}
writer.WriteLine(++count);
}
writer.Flush();
}
}
开发者ID:nberardi,项目名称:ravendb,代码行数:26,代码来源:EsentUtil.cs
示例3: 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");
}
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:34,代码来源:From50To51.cs
示例4: 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);
}
}
开发者ID:ajaishankar,项目名称:ravendb,代码行数:27,代码来源:From26To27.cs
示例5: GetvalueFromTable
private static object GetvalueFromTable(Session session, Table table, ColumnInfo col)
{
switch (col.Coltyp)
{
case JET_coltyp.Long:
return Api.RetrieveColumnAsInt32(session, table, col.Columnid);
case JET_coltyp.DateTime:
return Api.RetrieveColumnAsDateTime(session, table, col.Columnid);
case JET_coltyp.Binary:
var bytes = Api.RetrieveColumn(session, table, col.Columnid);
if (bytes == null)
return null;
if (bytes.Length == 16)
return new Guid(bytes);
return Convert.ToBase64String(bytes);
case JET_coltyp.LongText:
case JET_coltyp.Text:
var str = Api.RetrieveColumnAsString(session, table, col.Columnid);
if (str == null)
return null;
if (str.Contains("\""))
return "\"" + str.Replace("\"", "\"\"") + "\"";
return str;
case JET_coltyp.LongBinary:
return "long binary val";
default:
throw new ArgumentOutOfRangeException("don't know how to handle coltype: " + col.Coltyp);
}
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:29,代码来源:EsentUtil.cs
示例6: 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);
}
}
开发者ID:kenegozi,项目名称:ravendb,代码行数:29,代码来源:From24To24.cs
示例7: PopImpl
protected override CrawlerQueueEntry PopImpl()
{
return m_EsentInstance.Cursor((session, dbid) =>
{
using (Transaction transaction = new Transaction(session))
{
using (Table table = new Table(session, dbid, EsentTableDefinitions.QueueTableName, OpenTableGrbit.None))
{
if (Api.TryMoveFirst(session, table))
{
byte[] data = Api.RetrieveColumn(session, table, dataColumn.columnid);
Api.JetDelete(session, table);
using (Table table2 = new Table(session, dbid, EsentTableDefinitions.GlobalsTableName, OpenTableGrbit.None))
{
Api.EscrowUpdate(session, table2, queueCountColumn.columnid, -1);
}
transaction.Commit(CommitTransactionGrbit.None);
return data.FromBinary<CrawlerQueueEntry>();
}
}
transaction.Rollback();
return null;
}
});
}
开发者ID:osamede,项目名称:social_listen,代码行数:28,代码来源:EsentCrawlQueueService.cs
示例8: GetColumnIds
protected void GetColumnIds(
JET_SESID sessionId, Table table, out JET_COLUMNID projectColumnId, out JET_COLUMNID projectNameColumnId, out JET_COLUMNID documentColumnId)
{
projectColumnId = Api.GetTableColumnid(sessionId, table, ProjectColumnName);
projectNameColumnId = Api.GetTableColumnid(sessionId, table, ProjectNameColumnName);
documentColumnId = Api.GetTableColumnid(sessionId, table, DocumentColumnName);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:EsentStorage.ProjectDocumentTable.cs
示例9: AbstractActions
protected AbstractActions(JET_INSTANCE instance, ColumnsInformation columnsInformation, string database, Guid instanceId)
{
try
{
this.instanceId = instanceId;
ColumnsInformation = columnsInformation;
session = new Session(instance);
transaction = new Transaction(session);
Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
queues = new Table(session, dbid, "queues", OpenTableGrbit.None);
subqueues = new Table(session, dbid, "subqueues", OpenTableGrbit.None);
txs = new Table(session, dbid, "transactions", OpenTableGrbit.None);
recovery = new Table(session, dbid, "recovery", OpenTableGrbit.None);
outgoing = new Table(session, dbid, "outgoing", OpenTableGrbit.None);
outgoingHistory = new Table(session, dbid, "outgoing_history", OpenTableGrbit.None);
recveivedMsgs = new Table(session, dbid, "recveived_msgs", OpenTableGrbit.None);
}
catch (Exception)
{
Dispose();
throw;
}
}
开发者ID:hibernating-rhinos,项目名称:rhino-queues,代码行数:25,代码来源:AbstractActions.cs
示例10: InitColumDictionaries
public void InitColumDictionaries(JET_INSTANCE instance, string database)
{
using (var session = new Session(instance))
{
var dbid = JET_DBID.Nil;
try
{
Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
using (var usage = new Table(session, dbid, "usage", OpenTableGrbit.None))
UsageColumns = Api.GetColumnDictionary(session, usage);
using (var details = new Table(session, dbid, "details", OpenTableGrbit.None))
DetailsColumns = Api.GetColumnDictionary(session, details);
using (var pages = new Table(session, dbid, "pages", OpenTableGrbit.None))
PagesColumns = Api.GetColumnDictionary(session, pages);
using (var files = new Table(session, dbid, "files", OpenTableGrbit.None))
FilesColumns = Api.GetColumnDictionary(session, files);
using (var signatures = new Table(session, dbid, "signatures", OpenTableGrbit.None))
SignaturesColumns = Api.GetColumnDictionary(session, signatures);
using (var config = new Table(session, dbid, "config", OpenTableGrbit.None))
ConfigColumns = Api.GetColumnDictionary(session, config);
}
finally
{
if (Equals(dbid, JET_DBID.Nil) == false)
Api.JetCloseDatabase(session, dbid, CloseDatabaseGrbit.None);
}
}
}
开发者ID:hibernating-rhinos,项目名称:RavenFS,代码行数:28,代码来源:TableColumnsCache.cs
示例11: Update
public void Update(Session session, JET_DBID dbid, Action<string> output)
{
using (var table = new Table(session, dbid, "indexes_stats", OpenTableGrbit.None))
{
byte[] defaultValue = BitConverter.GetBytes(1);
JET_COLUMNID columnid;
Api.JetAddColumn(session, table, "priority", new JET_COLUMNDEF
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL
}, defaultValue, defaultValue.Length, out columnid);
defaultValue = BitConverter.GetBytes(0);
Api.JetAddColumn(session, table, "created_timestamp", new JET_COLUMNDEF
{
cbMax = 8, //64 bits
coltyp = JET_coltyp.Binary,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL
}, defaultValue, defaultValue.Length, out columnid);
Api.JetAddColumn(session, table, "last_indexing_time", new JET_COLUMNDEF
{
cbMax = 8, //64 bits
coltyp = JET_coltyp.Binary,
grbit = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL
}, defaultValue, defaultValue.Length, out columnid);
}
SchemaCreator.UpdateVersion(session, dbid, "4.6");
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:30,代码来源:From45To46.cs
示例12: Update
public void Update(Session session, JET_DBID dbid, Action<string> output)
{
using (var table = new Table(session, dbid, "config", OpenTableGrbit.DenyRead | OpenTableGrbit.PermitDDL))
{
JET_COLUMNID newMetadataColumnId;
Api.JetAddColumn(session, table, "metadata_new", new JET_COLUMNDEF
{
cbMax = 1024*512,
coltyp = JET_coltyp.LongText,
cp = JET_CP.Unicode,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out newMetadataColumnId);
}
using (var table = new Table(session, dbid, "config", OpenTableGrbit.None))
{
Api.MoveBeforeFirst(session, table);
var rows = 0;
var columnDictionary = Api.GetColumnDictionary(session, table);
var metadataColumn = columnDictionary["metadata"];
var nameColumn = columnDictionary["name"];
var newMetadataColumn = columnDictionary["metadata_new"];
while (Api.TryMoveNext(session, table))
{
using (var insert = new Update(session, table, JET_prep.Replace))
{
var name = Api.RetrieveColumnAsString(session, table, nameColumn, Encoding.Unicode);
var metadata = Api.RetrieveColumnAsString(session, table, metadataColumn, Encoding.Unicode);
var fixedMetadata = GuidToEtagMigrationInConfigurations(metadata, name);
Api.SetColumn(session, table, newMetadataColumn, fixedMetadata, Encoding.Unicode);
insert.Save();
}
if (rows++ % 100 == 0)
{
output("Processed " + (rows) + " rows from metadata column in config table");
Api.JetCommitTransaction(session, CommitTransactionGrbit.LazyFlush);
Api.JetBeginTransaction2(session, BeginTransactionGrbit.None);
}
}
Api.JetCommitTransaction(session, CommitTransactionGrbit.None);
// they cannot be run in transaction scope
Api.JetDeleteColumn(session, table, "metadata");
Api.JetRenameColumn(session, table, "metadata_new", "metadata", RenameColumnGrbit.None);
Api.JetBeginTransaction2(session, BeginTransactionGrbit.None);
}
SchemaCreator.UpdateVersion(session, dbid, "0.5");
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:59,代码来源:From04To05.cs
示例13: Update
public void Update(Session session, JET_DBID dbid)
{
using(var tx = new Transaction(session))
{
using (var mappedResults = new Table(session, dbid, "mapped_results", OpenTableGrbit.None))
{
JET_COLUMNID columnid;
Api.JetAddColumn(session, mappedResults, "reduce_key_and_view_hashed", new JET_COLUMNDEF
{
cbMax = 32,
coltyp = JET_coltyp.Binary,
grbit = ColumndefGrbit.ColumnNotNULL
}, null, 0, out columnid);
const string indexDef = "+reduce_key_and_view_hashed\0\0";
Api.JetCreateIndex(session, mappedResults, "by_reduce_key_and_view_hashed",
CreateIndexGrbit.IndexDisallowNull, indexDef, indexDef.Length,
100);
Api.JetDeleteIndex(session, mappedResults, "by_view_and_reduce_key");
var columnDictionary = Api.GetColumnDictionary(session, mappedResults);
Api.MoveBeforeFirst(session, mappedResults);
while (Api.TryMoveNext(session, mappedResults))
{
using (var update = new Update(session, mappedResults, JET_prep.Replace))
{
var computeHash = MapReduceIndex.ComputeHash(
Api.RetrieveColumnAsString(session, mappedResults, columnDictionary["view"],
Encoding.Unicode),
Api.RetrieveColumnAsString(session, mappedResults, columnDictionary["reduce_key"],
Encoding.Unicode));
Api.SetColumn(session, mappedResults, columnDictionary["reduce_key_and_view_hashed"],
computeHash);
update.Save();
}
}
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.2", Encoding.Unicode);
update.Save();
}
}
}
tx.Commit(CommitTransactionGrbit.None);
}
}
开发者ID:ajaishankar,项目名称:ravendb,代码行数:59,代码来源:From21To22.cs
示例14: Initialize
public override void Initialize(JET_SESID sessionId, JET_DBID databaseId)
{
using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly))
{
_idColumnId = Api.GetTableColumnid(sessionId, table, IdColumnName);
_identifierColumnId = Api.GetTableColumnid(sessionId, table, IdentifierColumnName);
}
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:EsentStorage.IdentifierTable.cs
示例15: Update
public void Update(Session session, JET_DBID dbid)
{
Transaction tx;
using (tx = new Transaction(session))
{
using ( var tbl = new Table(session, dbid, "indexes_stats",
OpenTableGrbit.PermitDDL | OpenTableGrbit.DenyRead | OpenTableGrbit.DenyWrite))
{
var columnDictionary = Api.GetColumnDictionary(session, tbl);
if (columnDictionary.ContainsKey("reduce_attempts"))
Api.JetDeleteColumn(session, tbl, "reduce_attempts");
if (columnDictionary.ContainsKey("reduce_errors"))
Api.JetDeleteColumn(session, tbl, "reduce_errors");
if (columnDictionary.ContainsKey("reduce_successes"))
Api.JetDeleteColumn(session, tbl, "reduce_successes");
}
CreateIndexesStatsReduce(session, dbid);
using (var stats = new Table(session, dbid, "indexes_stats",OpenTableGrbit.None))
using (var reduce = new Table(session, dbid, "indexes_stats_reduce", OpenTableGrbit.None))
{
var tblKeyColumn = Api.GetColumnDictionary(session, stats)["key"];
var reduceKeyCol = Api.GetColumnDictionary(session, reduce)["key"];
Api.MoveBeforeFirst(session, stats);
while (Api.TryMoveNext(session, stats))
{
using(var update = new Update(session, reduce, JET_prep.Insert))
{
var indexName = Api.RetrieveColumnAsString(session, stats, tblKeyColumn, Encoding.Unicode);
Api.SetColumn(session, reduce, reduceKeyCol, indexName, Encoding.Unicode);
update.Save();
}
}
}
tx.Commit(CommitTransactionGrbit.LazyFlush);
tx.Dispose();
tx = new Transaction(session);
}
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"], "3.4", Encoding.Unicode);
update.Save();
}
}
tx.Commit(CommitTransactionGrbit.None);
tx.Dispose();
}
开发者ID:kblooie,项目名称:ravendb,代码行数:58,代码来源:From33To34.cs
示例16: OpenSchema
private Table OpenSchema(JET_SESID sesid, JET_DBID dbid, out JET_COLUMNID primaryColumnId, out JET_COLUMNID secondaryColumnId)
{
var table = new Table(sesid, dbid, "table", OpenTableGrbit.None);
primaryColumnId = Api.GetTableColumnid(sesid, table, "key");
secondaryColumnId = Api.GetTableColumnid(sesid, table, "data");
return table;
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:9,代码来源:EsentTest.cs
示例17: Update
public void Update(Session session, JET_DBID dbid)
{
Transaction tx;
using (tx = new Transaction(session))
{
var count = 0;
const int rowsInTxCount = 100;
var tablesWithEtags = new[]
{
new {Table = "indexes_stats", Column = "last_indexed_etag"},
new {Table = "documents", Column = "etag"},
new {Table = "mapped_results", Column = "etag"},
new {Table = "files", Column = "etag"},
new {Table = "documents_modified_by_transaction", Column = "etag"},
};
foreach (var tablesWithEtag in tablesWithEtags)
{
using (var tbl = new Table(session, dbid, tablesWithEtag.Table, OpenTableGrbit.None))
{
var columnid = Api.GetColumnDictionary(session, tbl)[tablesWithEtag.Column];
Api.MoveBeforeFirst(session, tbl);
while (Api.TryMoveNext(session, tbl))
{
using (var update = new Update(session, tbl, JET_prep.Replace))
{
Api.SetColumn(session, tbl, columnid, Guid.Empty.TransformToValueForEsentSorting());
update.Save();
}
if (count++%rowsInTxCount == 0)
{
tx.Commit(CommitTransactionGrbit.LazyFlush);
tx.Dispose();
tx = new Transaction(session);
}
}
tx.Commit(CommitTransactionGrbit.LazyFlush);
tx.Dispose();
tx = new Transaction(session);
}
}
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"], "3.2", Encoding.Unicode);
update.Save();
}
}
tx.Commit(CommitTransactionGrbit.None);
tx.Dispose();
}
}
开发者ID:nzdunic,项目名称:ravendb,代码行数:57,代码来源:From30To32.cs
示例18: Initialize
public override void Initialize(JET_SESID sessionId, JET_DBID databaseId)
{
using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly))
{
GetColumnIds(sessionId, table, out _projectColumnId, out _projectNameColumnId);
_nameColumnId = Api.GetTableColumnid(sessionId, table, NameColumnName);
_valueColumnId = Api.GetTableColumnid(sessionId, table, ValueColumnName);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:EsentStorage.ProjectTable.cs
示例19: Initialize
public override void Initialize(JET_SESID sessionId, JET_DBID databaseId)
{
using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly))
{
GetColumnIds(sessionId, table, out _projectColumnId, out _projectNameColumnId, out _documentColumnId);
_identifierColumnId = Api.GetTableColumnid(sessionId, table, IdentifierColumnName);
_locationsColumnId = Api.GetTableColumnid(sessionId, table, LocationsColumnName);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:EsentStorage.IdentifierLocationTable.cs
示例20: AddColumn
public override void AddColumn(ColumnDefinition columnDef)
{
using (var transaction = new Transaction(connection.session))
using (var table = new Microsoft.Isam.Esent.Interop.Table(connection.session, connection.dbid, name, OpenTableGrbit.None)) {
var tableCreator = new EseTableCreator(connection);
tableCreator.AddColumn(table, columnDef);
transaction.Commit(CommitTransactionGrbit.None);
}
RefreshTableInfo();
}
开发者ID:purplecow,项目名称:simplestorageengine,代码行数:10,代码来源:EseTable.cs
注:本文中的Microsoft.Isam.Esent.Interop.Table类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论