in EsentInteropTests/ContentEquatableTests.cs [769:915]
public void VerifyJetTablecreateInequality()
{
var columncreates = new[]
{
new JET_COLUMNCREATE
{
szColumnName = "col1_short",
coltyp = JET_coltyp.Short,
cbMax = 2,
},
new JET_COLUMNCREATE
{
szColumnName = "col2_longtext",
coltyp = JET_coltyp.LongText,
cp = JET_CP.Unicode,
},
};
const string Index1Name = "firstIndex";
const string Index1Description = "+col1_short\0-col2_longtext\0";
const string Index2Name = "secondIndex";
const string Index2Description = "+col2_longtext\0-col1_short\0";
var spacehintsIndex = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintHotpointSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsSeq = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsLv = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanBackward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var indexcreates = new[]
{
new JET_INDEXCREATE
{
szIndexName = Index1Name,
szKey = Index1Description,
cbKey = Index1Description.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 99,
pSpaceHints = spacehintsIndex,
},
null,
new JET_INDEXCREATE
{
szIndexName = Index2Name,
szKey = Index2Description,
cbKey = Index2Description.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 79,
},
};
JET_TABLEID tableidTemp = new JET_TABLEID()
{
Value = (IntPtr)2,
};
var tablecreates = new JET_TABLECREATE[21];
for (int i = 0; i < tablecreates.Length; ++i)
{
tablecreates[i] = new JET_TABLECREATE
{
szTableName = "tableBigBang",
ulPages = 23,
ulDensity = 75,
cColumns = columncreates.Length,
rgcolumncreate = columncreates,
rgindexcreate = indexcreates,
cIndexes = indexcreates.Length,
cbSeparateLV = 100,
cbtyp = JET_cbtyp.Null,
grbit = CreateTableColumnIndexGrbit.TemplateTable,
pSeqSpacehints = spacehintsSeq,
pLVSpacehints = spacehintsLv,
tableid = tableidTemp,
cCreated = 7,
};
}
int j = 1;
tablecreates[j++].szTableName = "different";
tablecreates[j++].ulPages = 57;
tablecreates[j++].ulDensity = 98;
tablecreates[j++].cColumns = 1;
tablecreates[j++].rgcolumncreate = new[]
{
null,
columncreates[0],
};
tablecreates[j].rgcolumncreate = null;
tablecreates[j++].cColumns = 0;
tablecreates[j++].cIndexes--;
tablecreates[j++].cbSeparateLV = 24;
tablecreates[j++].rgindexcreate = new[]
{
indexcreates[1],
indexcreates[0],
indexcreates[0],
};
tablecreates[j++].rgindexcreate = new[]
{
indexcreates[1],
null,
indexcreates[0],
};
tablecreates[j].rgindexcreate = null;
tablecreates[j++].cIndexes = 0;
tablecreates[j++].cbtyp = JET_cbtyp.AfterInsert;
tablecreates[j++].grbit = CreateTableColumnIndexGrbit.FixedDDL;
tablecreates[j++].pSeqSpacehints = spacehintsLv;
tablecreates[j++].pSeqSpacehints = null;
tablecreates[j++].pLVSpacehints = spacehintsSeq;
tablecreates[j++].pLVSpacehints = null;
tableidTemp.Value = new IntPtr(63);
tablecreates[j++].tableid = tableidTemp;
tablecreates[j++].cCreated--;
tablecreates[j++] = new JET_TABLECREATE();
Debug.Assert(j == tablecreates.Length, "Didn't fill in all entries of tablecreates");
VerifyAll(tablecreates);
}