mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-28 10:31:04 +00:00
ESENT: fix the index creation failure #277
This commit is contained in:
parent
dfef7a622f
commit
0cb0f9303d
|
|
@ -15,7 +15,6 @@ namespace WelsonJS.Launcher
|
||||||
private string entryFileName;
|
private string entryFileName;
|
||||||
private string scriptName;
|
private string scriptName;
|
||||||
private const string timestampFormat = "yyyy-MM-dd HH:mm:ss";
|
private const string timestampFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
private static MetadataStore metadataStore;
|
|
||||||
|
|
||||||
public InstancesForm()
|
public InstancesForm()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -105,20 +105,22 @@ namespace WelsonJS.Launcher
|
||||||
Api.JetAddColumn(_session, tableid, col.Name, coldef, null, 0, out _);
|
Api.JetAddColumn(_session, tableid, col.Name, coldef, null, 0, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
string indexName = "primary";
|
string indexKey = $"+{_primaryKey.Name}\0";
|
||||||
string indexKey = $"+{_primaryKey}\0\0"; // Primary key ASC
|
int keyLength = Encoding.ASCII.GetByteCount(indexKey + "\0"); // double null-terminated
|
||||||
|
string fullKeyDescription = indexKey + "\0";
|
||||||
|
|
||||||
Api.JetCreateIndex(
|
Api.JetCreateIndex(
|
||||||
_session,
|
_session,
|
||||||
tableid,
|
tableid,
|
||||||
indexName,
|
"primary",
|
||||||
CreateIndexGrbit.IndexPrimary | CreateIndexGrbit.IndexUnique,
|
CreateIndexGrbit.IndexPrimary | CreateIndexGrbit.IndexUnique,
|
||||||
indexKey,
|
fullKeyDescription,
|
||||||
indexKey.Length,
|
keyLength,
|
||||||
100);
|
100
|
||||||
|
);
|
||||||
|
|
||||||
Api.JetCloseTable(_session, tableid);
|
|
||||||
Api.JetCommitTransaction(_session, CommitTransactionGrbit.None);
|
Api.JetCommitTransaction(_session, CommitTransactionGrbit.None);
|
||||||
|
Api.JetCloseTable(_session, tableid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CacheColumns()
|
private void CacheColumns()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user