public void Setup()
 {
     this.managed = new JET_CONDITIONALCOLUMN
     {
         szColumnName = "column",
         grbit = ConditionalColumnGrbit.ColumnMustBeNonNull,
     };
     this.native = this.managed.GetNativeConditionalColumn();
 }
示例#2
0
 public void JetConditionalColumnToString()
 {
     var conditionalcolumn = new JET_CONDITIONALCOLUMN { szColumnName = "Foo", grbit = ConditionalColumnGrbit.ColumnMustBeNull };
     Assert.AreEqual("JET_CONDITIONALCOLUMN(Foo:ColumnMustBeNull)", conditionalcolumn.ToString());
 }
        /// <summary>
        /// Create a JET_INDEXCREATE for the specified index.
        /// </summary>
        /// <param name="name">Name of the index.</param>
        /// <param name="key">Index key.</param>
        /// <param name="mustBeTrue">Columns that must be null.</param>
        /// <param name="mustBeFalse">Columns that must not be null.</param>
        /// <returns>A JET_INDEXCREATE describing the index.</returns>
        private static JET_INDEXCREATE GetIndexCreate(string name, string key, string[] mustBeTrue, string[] mustBeFalse)
        {
            var conditionalcolumns = new JET_CONDITIONALCOLUMN[mustBeTrue.Length + mustBeFalse.Length];
            int i = 0;
            foreach (string column in mustBeTrue)
            {
                conditionalcolumns[i++] = new JET_CONDITIONALCOLUMN
                {
                    szColumnName = column,
                    grbit = ConditionalColumnGrbit.ColumnMustBeNonNull,
                };
            }

            foreach (string column in mustBeFalse)
            {
                conditionalcolumns[i++] = new JET_CONDITIONALCOLUMN
                {
                    szColumnName = column,
                    grbit = ConditionalColumnGrbit.ColumnMustBeNull,
                };
            }

            return new JET_INDEXCREATE
            {
                szIndexName = name,
                szKey = key,
                cbKey = key.Length,
                rgconditionalcolumn = conditionalcolumns,
                cConditionalColumn = conditionalcolumns.Length,
            };
        }