예제 #1
0
        public void JetGetTableColumnBaseInfo()
        {
            const string ColumnName = "column1";

            Api.JetBeginTransaction(this.sesid);
            var columndef = new JET_COLUMNDEF()
            {
                cbMax  = 4096,
                cp     = JET_CP.Unicode,
                coltyp = JET_coltyp.LongText,
                grbit  = ColumndefGrbit.None,
            };

            JET_COLUMNID columnid;

            Api.JetAddColumn(this.sesid, this.tableid, ColumnName, columndef, null, 0, out columnid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);

            JET_COLUMNBASE retrievedColumnbase;

            Api.JetGetTableColumnInfo(this.sesid, this.tableid, ColumnName, out retrievedColumnbase);

            Assert.AreEqual(columndef.cbMax, retrievedColumnbase.cbMax);
            Assert.AreEqual(columndef.cp, retrievedColumnbase.cp);
            Assert.AreEqual(columndef.coltyp, retrievedColumnbase.coltyp);
            Assert.AreEqual(columnid, retrievedColumnbase.columnid);
            Assert.AreEqual(this.table, retrievedColumnbase.szBaseTableName);
            Assert.AreEqual(ColumnName, retrievedColumnbase.szBaseColumnName);

            // The output grbit isn't checked for equality as esent will add some options by default.
        }
예제 #2
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = getTextBaseColumnDef();

            res.coltyp = JET_coltyp.Text;

            if (bUnicode)
            {
                res.cbMax = m_maxChars * 2;
                if (m_maxChars > 127)
                {
                    throw new ArgumentOutOfRangeException("The Unicode text columns can't be larger then 127 characters.", (Exception)null);
                }
            }
            else
            {
                res.cbMax = m_maxChars;
                if (m_maxChars > 255)
                {
                    throw new ArgumentOutOfRangeException("The ASCII text columns can't be larger then 255 characters.", (Exception)null);
                }
            }

            if (m_bFixed)
            {
                res.grbit |= ColumndefGrbit.ColumnFixed;
            }
            return(res);
        }
예제 #3
0
파일: EsentConfig.cs 프로젝트: nka1/Daytona
        /// <summary>
        /// Create the required columns and indexes for the message store.
        /// Creates 3 columns, an ID column, a Message colum for the data and a metadata colum that stores information on the message and the subscribers
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="tableid">
        /// The table to add the columns/indexes to. This table must be opened exclusively.
        /// </param>
        private static void CreateColumnsAndIndexes(JET_SESID sesid, JET_TABLEID tableid)
        {
            using (var transaction = new Transaction(sesid))
            {
                JET_COLUMNID columnid;

                var columndef = new JET_COLUMNDEF
                {
                    coltyp = JET_coltyp.LongBinary
                };

                Api.JetAddColumn(sesid, tableid, "payload", columndef, null, 0, out columnid);

                columndef = new JET_COLUMNDEF
                {
                    coltyp = JET_coltyp.Long,
                    grbit  = ColumndefGrbit.ColumnAutoincrement
                };

                Api.JetAddColumn(sesid, tableid, "id", columndef, null, 0, out columnid);

                string indexDef = "+id\0\0";
                Api.JetCreateIndex(sesid, tableid, "primary", CreateIndexGrbit.IndexPrimary, indexDef, indexDef.Length, 100);

                transaction.Commit(CommitTransactionGrbit.LazyFlush);
            }
        }
예제 #4
0
        public void Setup()
        {
            this.directory = SetupHelper.CreateRandomDirectory();
            this.database  = Path.Combine(this.directory, "database.edb");
            this.table     = "table";
            this.instance  = SetupHelper.CreateNewInstance(this.directory);

            Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.PageTempDBMin, SystemParameters.PageTempDBSmallest, null);
            Api.JetInit(ref this.instance);
            Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
            Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None);
            Api.JetBeginTransaction(this.sesid);
            Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);

            var columndef = new JET_COLUMNDEF()
            {
                cp     = JET_CP.Unicode,
                coltyp = JET_coltyp.LongText,
            };

            Api.JetAddColumn(this.sesid, this.tableid, "TestColumn", columndef, null, 0, out this.columnidLongText);

            Api.JetCloseTable(this.sesid, this.tableid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
            Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
        }
예제 #5
0
        public void HowDoIRetrieveAnAutoInc()
        {
            JET_SESID sesid = this.testSession;
            JET_DBID  dbid  = this.testDbid;

            JET_TABLEID   tableid;
            JET_COLUMNDEF columndef = new JET_COLUMNDEF();
            JET_COLUMNID  autoincColumn;

            // First create the table. There is one autoinc column.
            Api.JetCreateTable(sesid, dbid, "table", 0, 100, out tableid);
            columndef.coltyp = JET_coltyp.Long;
            columndef.grbit  = ColumndefGrbit.ColumnAutoincrement;
            Api.JetAddColumn(sesid, tableid, "data", columndef, null, 0, out autoincColumn);

            // Once the update is prepared the autoinc column can be retrieved. This
            // requires the RetrieveCopy option, which gets a value from the record
            // currently under construction.
            for (int i = 0; i < 10; i++)
            {
                using (var update = new Update(sesid, tableid, JET_prep.Insert))
                {
                    int?autoinc = Api.RetrieveColumnAsInt32(
                        sesid,
                        tableid,
                        autoincColumn,
                        RetrieveColumnGrbit.RetrieveCopy);
                    Console.WriteLine("{0}", autoinc);
                    update.Save();
                }
            }
        }
예제 #6
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsColtypShort()
        {
            ColumnDefinition def       = DefinedAs.Int16Column(Any.String);
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(JET_coltyp.Short, columndef.coltyp);
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        public void Setup()
        {
            this.directory = SetupHelper.CreateRandomDirectory();
            this.database  = Path.Combine(this.directory, "database.edb");
            this.table     = "table";
            this.instance  = SetupHelper.CreateNewInstance(this.directory);

            Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null);
            Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
            Api.JetInit(ref this.instance);
            Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
            Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None);
            Api.JetBeginTransaction(this.sesid);
            Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);

            var columndef = new JET_COLUMNDEF()
            {
                coltyp = JET_coltyp.Long,
                grbit  = ColumndefGrbit.ColumnEscrowUpdate,
            };

            Api.JetAddColumn(this.sesid, this.tableid, "EscrowColumn", columndef, BitConverter.GetBytes(0), 4, out this.columnid);

            Api.JetCloseTable(this.sesid, this.tableid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
            Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
            Api.JetBeginTransaction(this.sesid);
            Api.JetPrepareUpdate(this.sesid, this.tableid, JET_prep.Insert);
            Api.JetUpdate(this.sesid, this.tableid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
            Api.JetMove(this.sesid, this.tableid, JET_Move.First, MoveGrbit.None);
        }
예제 #9
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsColtypDouble()
        {
            ColumnDefinition def       = DefinedAs.DoubleColumn(Any.String);
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(JET_coltyp.IEEEDouble, columndef.coltyp);
        }
예제 #10
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = base.getColumnDef();

            res.coltyp = JET_coltyp.Currency;
            return(res);
        }
예제 #11
0
        /// <summary>
        /// Main routine. Called when the program starts.
        /// </summary>
        /// <param name="args">
        /// The arguments to the program.
        /// </param>
        public static void Main(string[] args)
        {
            JET_INSTANCE instance;
            JET_SESID    sesid;
            JET_DBID     dbid;
            JET_TABLEID  tableid;

            JET_COLUMNDEF columndef = new JET_COLUMNDEF();
            JET_COLUMNID  columnid;

            // Initialize ESENT. Setting JET_param.CircularLog to 1 means ESENT will automatically
            // delete unneeded logfiles. JetInit will inspect the logfiles to see if the last
            // shutdown was clean. If it wasn't (e.g. the application crashed) recovery will be
            // run automatically bringing the database to a consistent state.
            Api.JetCreateInstance(out instance, "instance");
            Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.CircularLog, 1, null);
            Api.JetInit(ref instance);
            Api.JetBeginSession(instance, out sesid, null, null);

            // Create the database. To open an existing database use the JetAttachDatabase and
            // JetOpenDatabase APIs.
            Api.JetCreateDatabase(sesid, "edbtest.db", null, out dbid, CreateDatabaseGrbit.OverwriteExisting);

            // Create the table. Meta-data operations are transacted and can be performed concurrently.
            // For example, one session can add a column to a table while another session is reading
            // or updating records in the same table.
            // This table has no indexes defined, so it will use the default sequential index. Indexes
            // can be defined with the JetCreateIndex API.
            Api.JetBeginTransaction(sesid);
            Api.JetCreateTable(sesid, dbid, "table", 0, 100, out tableid);
            columndef.coltyp = JET_coltyp.LongText;
            columndef.cp     = JET_CP.ASCII;
            Api.JetAddColumn(sesid, tableid, "column1", columndef, null, 0, out columnid);
            Api.JetCommitTransaction(sesid, CommitTransactionGrbit.LazyFlush);

            // Insert a record. This table only has one column but a table can have slightly over 64,000
            // columns defined. Unless a column is declared as fixed or variable it won't take any space
            // in the record unless set. An individual record can have several hundred columns set at one
            // time, the exact number depends on the database page size and the contents of the columns.
            Api.JetBeginTransaction(sesid);
            Api.JetPrepareUpdate(sesid, tableid, JET_prep.Insert);
            string message = "Hello world";

            Api.SetColumn(sesid, tableid, columnid, message, Encoding.ASCII);
            Api.JetUpdate(sesid, tableid);
            Api.JetCommitTransaction(sesid, CommitTransactionGrbit.None);    // Use JetRollback() to abort the transaction

            // Retrieve a column from the record. Here we move to the first record with JetMove. By using
            // JetMoveNext it is possible to iterate through all records in a table. Use JetMakeKey and
            // JetSeek to move to a particular record.
            Api.JetMove(sesid, tableid, JET_Move.First, MoveGrbit.None);
            string buffer = Api.RetrieveColumnAsString(sesid, tableid, columnid, Encoding.ASCII);

            Console.WriteLine("{0}", buffer);

            // Terminate ESENT. This performs a clean shutdown.
            Api.JetCloseTable(sesid, tableid);
            Api.JetEndSession(sesid, EndSessionGrbit.None);
            Api.JetTerm(instance);
        }
예제 #12
0
        public void JetGetColumnInfo()
        {
            string columnName = "column3";

            Api.JetBeginTransaction(this.sesid);
            var columndef = new JET_COLUMNDEF()
            {
                cbMax  = 200,
                cp     = JET_CP.ASCII,
                coltyp = JET_coltyp.LongText,
                grbit  = ColumndefGrbit.None,
            };

            JET_COLUMNID columnid;

            Api.JetAddColumn(this.sesid, this.tableid, columnName, columndef, null, 0, out columnid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
            JET_COLUMNDEF retrievedColumndef;

            Api.JetGetColumnInfo(this.sesid, this.dbid, this.table, columnName, out retrievedColumndef);

            Assert.AreEqual(columndef.cbMax, retrievedColumndef.cbMax);
            Assert.AreEqual(columndef.cp, retrievedColumndef.cp);
            Assert.AreEqual(columndef.coltyp, retrievedColumndef.coltyp);
            Assert.AreEqual(columnid, retrievedColumndef.columnid);

            // The grbit isn't asserted as esent will add some options by default
        }
예제 #13
0
        public void TestJetDeleteColumn2()
        {
            const string ColumnName = "column_to_delete";

            Api.JetBeginTransaction(this.sesid);
            var columndef = new JET_COLUMNDEF()
            {
                coltyp = JET_coltyp.Long
            };
            JET_COLUMNID columnid;

            Api.JetAddColumn(this.sesid, this.tableid, ColumnName, columndef, null, 0, out columnid);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);

            Api.JetBeginTransaction(this.sesid);
            Api.JetDeleteColumn2(this.sesid, this.tableid, ColumnName, DeleteColumnGrbit.None);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);

            try
            {
                // TODO: deal with versions of this API that return info on the deleted column
                Api.JetGetTableColumnInfo(this.sesid, this.tableid, ColumnName, out columndef);
                Assert.Fail("Column is still visible");
            }
            catch (EsentErrorException)
            {
            }
        }
예제 #14
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsVersion()
        {
            ColumnDefinition def       = DefinedAs.Int64Column(Any.String).AsVersion();
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(ColumndefGrbit.ColumnVersion, columndef.grbit);
        }
예제 #15
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = base.getColumnDef();

            res.coltyp = JET_coltyp.IEEEDouble;
            return(res);
        }
예제 #16
0
        public void VerifyJetColumndefEquality()
        {
            var x = new JET_COLUMNDEF
            {
                cbMax    = 1,
                coltyp   = JET_coltyp.Bit,
                columnid = new JET_COLUMNID {
                    Value = 1
                },
                cp    = JET_CP.ASCII,
                grbit = ColumndefGrbit.None
            };
            var y = new JET_COLUMNDEF
            {
                cbMax    = 1,
                coltyp   = JET_coltyp.Bit,
                columnid = new JET_COLUMNID {
                    Value = 1
                },
                cp    = JET_CP.ASCII,
                grbit = ColumndefGrbit.None
            };

            TestContentEquals(x, y);
        }
예제 #17
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsCbMax()
        {
            ColumnDefinition def       = DefinedAs.BinaryColumn(Any.String).WithMaxSize(25);
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(25, columndef.cbMax);
        }
예제 #18
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsIsNotNull()
        {
            ColumnDefinition def       = DefinedAs.Int64Column(Any.String).MustBeNonNull();
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(ColumndefGrbit.ColumnNotNULL, columndef.grbit);
        }
예제 #19
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = base.getColumnDef();

            res.coltyp = JET_coltyp.UnsignedByte;
            return(res);
        }
예제 #20
0
        public void VerifyCreateColumndefFromColumnDefinitionSetsCodePageForAsciiColumn()
        {
            ColumnDefinition def       = DefinedAs.AsciiTextColumn(Any.String);
            JET_COLUMNDEF    columndef = this.converter.CreateColumndefFromColumnDefinition(def);

            Assert.AreEqual(JET_CP.ASCII, columndef.cp);
        }
예제 #21
0
        public void TestJetSetColumnDefaultValue()
        {
            JET_TABLEID tableid;

            Api.JetCreateTable(this.sesid, this.dbid, "table", 1, 100, out tableid);

            // The column needs to be a tagged column so the default value isn't persisted
            // in the record at insert time.
            var columndef = new JET_COLUMNDEF
            {
                coltyp = JET_coltyp.LongText,
                cp     = JET_CP.Unicode,
            };

            byte[]       defaultValue = Encoding.ASCII.GetBytes("default");
            JET_COLUMNID columnid;

            Api.JetAddColumn(this.sesid, tableid, "column", columndef, defaultValue, defaultValue.Length, out columnid);
            Api.JetPrepareUpdate(this.sesid, tableid, JET_prep.Insert);
            Api.JetUpdate(this.sesid, tableid);
            Assert.AreEqual("default", this.RetrieveAsciiColumnFromFirstRecord(tableid, columnid));
            Api.JetCloseTable(this.sesid, tableid);

            byte[] newDefaultValue = Encoding.ASCII.GetBytes("newfault");
            Api.JetSetColumnDefaultValue(
                this.sesid, this.dbid, "table", "column", newDefaultValue, newDefaultValue.Length, SetColumnDefaultValueGrbit.None);

            Api.JetOpenTable(this.sesid, this.dbid, "table", null, 0, OpenTableGrbit.None, out tableid);
            Assert.AreEqual("newfault", this.RetrieveAsciiColumnFromFirstRecord(tableid, columnid));
        }
예제 #22
0
        public void Setup()
        {
            this.directory = SetupHelper.CreateRandomDirectory();
            this.database  = Path.Combine(this.directory, "database.edb");
            this.table     = "table";
            this.instance  = SetupHelper.CreateNewInstance(this.directory);

            Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
            Api.JetInit(ref this.instance);
            Api.JetBeginSession(this.instance, out this.sesid, string.Empty, string.Empty);
            Api.JetCreateDatabase(this.sesid, this.database, string.Empty, out this.dbid, CreateDatabaseGrbit.None);
            Api.JetBeginTransaction(this.sesid);
            Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);

            JET_COLUMNID ignored;
            var          columndef = new JET_COLUMNDEF {
                coltyp = JET_coltyp.Text, cp = JET_CP.Unicode
            };

            Api.JetAddColumn(this.sesid, this.tableid, "C1", columndef, null, 0, out ignored);
            Api.JetAddColumn(this.sesid, this.tableid, "C2", columndef, null, 0, out ignored);
            Api.JetAddColumn(this.sesid, this.tableid, "C3", columndef, null, 0, out ignored);

            Api.JetCreateIndex(this.sesid, this.tableid, "Primary", CreateIndexGrbit.IndexPrimary, "+C1\0\0", 5, 100);
            Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);

            JET_INDEXCREATE[] indexcreates = new[]
            {
                new JET_INDEXCREATE {
                    szIndexName = "Index2", cbKey = 5, szKey = "+C2\0\0"
                },
                new JET_INDEXCREATE {
                    szIndexName = "Index3", cbKey = 5, szKey = "+C3\0\0", cbVarSegMac = 100
                },
            };
            Api.JetCreateIndex2(this.sesid, this.tableid, indexcreates, indexcreates.Length);

            if (EsentVersion.SupportsWindows8Features)
            {
                var unicode = new JET_UNICODEINDEX()
                {
                    szLocaleName = "pt-br",
                    dwMapFlags   = Conversions.LCMapFlagsFromCompareOptions(CompareOptions.None),
                };

                var indexcreate = new JET_INDEXCREATE
                {
                    szIndexName = "win8BrazilIndex",
                    szKey       = "+C2\0\0",
                    cbKey       = 5,
                    pidxUnicode = unicode,
                    grbit       = CreateIndexGrbit.IndexIgnoreAnyNull,
                    ulDensity   = 100,
                };
                Windows8Api.JetCreateIndex4(this.sesid, this.tableid, new[] { indexcreate }, 1);
            }

            Api.JetCloseTable(this.sesid, this.tableid);
            Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
        }
예제 #23
0
        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 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.
                var 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);
            }
        }
예제 #24
0
        public void VerifyColumndefCanBeSerialized()
        {
            var expected = new JET_COLUMNDEF {
                coltyp = JET_coltyp.IEEESingle
            };

            SerializeAndCompareContent(expected);
        }
예제 #25
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = getTextBaseColumnDef();

            res.coltyp = JET_coltyp.LongText;
            res.grbit |= ColumndefGrbit.ColumnTagged;
            return(res);
        }
예제 #26
0
        public void JetColumndefToString()
        {
            var columndef = new JET_COLUMNDEF {
                coltyp = JET_coltyp.Text, grbit = ColumndefGrbit.ColumnFixed
            };

            Assert.AreEqual("JET_COLUMNDEF(Text,ColumnFixed)", columndef.ToString());
        }
예제 #27
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = new JET_COLUMNDEF();

            res.coltyp = JET_coltyp.Long;
            res.grbit  = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnVersion;
            return(res);
        }
예제 #28
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = new JET_COLUMNDEF();

            res.coltyp = JET_coltyp.LongBinary;
            res.grbit  = ColumndefGrbit.ColumnTagged;
            return(res);
        }
예제 #29
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = new JET_COLUMNDEF();

            res.coltyp = m_cp;
            res.grbit  = ColumndefGrbit.ColumnFixed | ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnAutoincrement;
            return(res);
        }
예제 #30
0
        /// <summary>Get column definition.</summary>
        public override JET_COLUMNDEF getColumnDef()
        {
            JET_COLUMNDEF res = base.getColumnDef();

            res.coltyp = JET_coltyp.Binary;
            res.cbMax  = 16;
            return(res);
        }