• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# JET_DBID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中JET_DBID的典型用法代码示例。如果您正苦于以下问题:C# JET_DBID类的具体用法?C# JET_DBID怎么用?C# JET_DBID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JET_DBID类属于命名空间,在下文中一共展示了JET_DBID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
		}
开发者ID:jtmueller,项目名称:ravendb,代码行数:25,代码来源:From35To36.cs


示例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);
            }
开发者ID:Rickinio,项目名称:roslyn,代码行数:25,代码来源:EsentStorage.IdentifierTable.cs


示例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);
            }
        }
开发者ID:Artoymyp,项目名称:XbimEssentials,代码行数:31,代码来源:XbimHeaderTable.cs


示例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);
            }
           
        }
开发者ID:Artoymyp,项目名称:XbimEssentials,代码行数:60,代码来源:XbimGeometryCursor.cs


示例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");
            }
        }
开发者ID:ricardobrandao,项目名称:ravendb,代码行数:29,代码来源:From52To53.cs


示例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);
            }
        }
开发者ID:simonkang,项目名称:NAppProfiler,代码行数:26,代码来源:IndexTableSchema.cs


示例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);
			}
		}
开发者ID:ajaishankar,项目名称:ravendb,代码行数:27,代码来源:From26To27.cs


示例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");
			}
		}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:34,代码来源:From50To51.cs


示例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);
        }
开发者ID:brumschlag,项目名称:rhino-tools,代码行数:27,代码来源:SchemaCreator.cs


示例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);
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:32,代码来源:EsentChainStateSchema.cs


示例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();
            }
        }
开发者ID:stantoxt,项目名称:rhino-queues,代码行数:28,代码来源:SchemaCreator.cs


示例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();
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:15,代码来源:Table.cs


示例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);
            }
        }
开发者ID:kenegozi,项目名称:ravendb,代码行数:29,代码来源:From24To24.cs


示例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);
		}
开发者ID:bstrausser,项目名称:ravendb,代码行数:26,代码来源:SchemaCreator.cs


示例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
			});
		}
开发者ID:925coder,项目名称:ravendb,代码行数:29,代码来源:SchemaCreator.cs


示例16: CreateHeadersTable

        private static void CreateHeadersTable(JET_DBID utxoDbId, Session jetSession)
        {
            JET_TABLEID headersTableId;
            JET_COLUMNID blockHashColumnId;
            JET_COLUMNID headerBytesColumnId;

            Api.JetCreateTable(jetSession, utxoDbId, "Headers", 0, 0, out headersTableId);
            Api.JetAddColumn(jetSession, headersTableId, "BlockHash", new JET_COLUMNDEF { coltyp = JET_coltyp.Binary, cbMax = 32, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out blockHashColumnId);
            Api.JetAddColumn(jetSession, headersTableId, "HeaderBytes", new JET_COLUMNDEF { coltyp = JET_coltyp.Binary, grbit = ColumndefGrbit.ColumnNotNULL }, null, 0, out headerBytesColumnId);

            Api.JetCreateIndex2(jetSession, headersTableId,
                new JET_INDEXCREATE[]
                    {
                        new JET_INDEXCREATE
                        {
                            cbKeyMost = 255,
                            grbit = CreateIndexGrbit.IndexUnique | CreateIndexGrbit.IndexDisallowNull,
                            szIndexName = "IX_BlockHash",
                            szKey = "+BlockHash\0\0",
                            cbKey = "+BlockHash\0\0".Length
                        }
                    }, 1);

            Api.JetCloseTable(jetSession, headersTableId);
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:25,代码来源:EsentChainStateSchema.cs


示例17: Create

            public override void Create(JET_SESID sessionId, JET_DBID databaseId)
            {
                var identifierColumnCreate = CreateIdColumn(IdentifierColumnName);
                var locationsColumnCreate = CreateBinaryColumn(LocationsColumnName);

                var columns = CreateProjectDocumentColumns(identifierColumnCreate, locationsColumnCreate);

                var primaryIndexKey = CreateProjectDocumentIndexKey(IdentifierColumnName);

                var indexes = new JET_INDEXCREATE[]
                {
                    CreatePrimaryIndex(primaryIndexKey)
                };

                var tableCreate = CreateTable(TableName, columns, indexes);

                Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate);

                GetColumnIds(columns, out _projectColumnId, out _projectNameColumnId, out _documentColumnId);

                _identifierColumnId = identifierColumnCreate.columnid;
                _locationsColumnId = locationsColumnCreate.columnid;

                Api.JetCloseTable(sessionId, tableCreate.tableid);
            }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:25,代码来源:EsentStorage.IdentifierLocationTable.cs


示例18: 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


示例19: 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


示例20: 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



注:本文中的JET_DBID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JET_INSTANCE类代码示例发布时间:2022-05-24
下一篇:
C# JET_COLUMNID类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap