public void JetObjectlistToString()
        {
            var value = new JET_OBJECTLIST {
                cRecord = 3, tableid = new JET_TABLEID {
                    Value = (IntPtr)0x1a
                }
            };

            Assert.AreEqual("JET_OBJECTLIST(0x1a,3 records)", value.ToString());
        }
        public void ConvertObjectlistFromNative()
        {
            var tableid = new JET_TABLEID {
                Value = (IntPtr)0x1000
            };
            var col1 = new JET_COLUMNID {
                Value = 1
            };
            var col2 = new JET_COLUMNID {
                Value = 2
            };
            var col3 = new JET_COLUMNID {
                Value = 3
            };
            var col4 = new JET_COLUMNID {
                Value = 4
            };
            var col5 = new JET_COLUMNID {
                Value = 5
            };
            var col6 = new JET_COLUMNID {
                Value = 6
            };

            var native = new NATIVE_OBJECTLIST()
            {
                tableid            = tableid.Value,
                cRecord            = 100,
                columnidobjectname = col1.Value,
                columnidobjtyp     = col2.Value,
                columnidgrbit      = col3.Value,
                columnidflags      = col4.Value,
                columnidcRecord    = col5.Value,
                columnidcPage      = col6.Value,
            };

            var objectlist = new JET_OBJECTLIST();

            objectlist.SetFromNativeObjectlist(native);

            Assert.AreEqual(tableid, objectlist.tableid);
            Assert.AreEqual(100, objectlist.cRecord);
            Assert.AreEqual(col1, objectlist.columnidobjectname);
            Assert.AreEqual(col2, objectlist.columnidobjtyp);
            Assert.AreEqual(col3, objectlist.columnidgrbit);
            Assert.AreEqual(col4, objectlist.columnidflags);
            Assert.AreEqual(col5, objectlist.columnidcRecord);
            Assert.AreEqual(col6, objectlist.columnidcPage);
        }
        public void Setup()
        {
            this.native = new NATIVE_OBJECTLIST()
            {
                tableid            = new IntPtr(0x100),
                cRecord            = 100,
                columnidobjectname = 1,
                columnidobjtyp     = 2,
                columnidgrbit      = 3,
                columnidflags      = 4,
                columnidcRecord    = 5,
                columnidcPage      = 6,
            };

            this.managed = new JET_OBJECTLIST();
            this.managed.SetFromNativeObjectlist(this.native);
        }
Beispiel #4
0
        /// <summary>
        /// Loads the specified table specified in the <see cref="JET_OBJECTLIST"/> object.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <param name="objectList">The object list.</param>
        /// <returns>A <see cref="TableDefinition"/> corresponding to the table specified in <paramref name="objectList"/>.</returns>
        internal static TableDefinition Load(IsamDatabase database, JET_OBJECTLIST objectList)
        {
            lock (database.IsamSession)
            {
                // save the database
                TableDefinition tableDefinition = new TableDefinition();
                tableDefinition.database = database;

                // load info for the table
                tableDefinition.name = Api.RetrieveColumnAsString(
                    database.IsamSession.Sesid,
                    objectList.tableid,
                    objectList.columnidobjectname);

                // create our column and index collections
                tableDefinition.columnCollection = new ColumnCollection(database, tableDefinition.name);
                tableDefinition.indexCollection  = new IndexCollection(database, tableDefinition.name);

                return(tableDefinition);
            }
        }