ESENT: fix the index creation failure #277

This commit is contained in:
Namhyeon Go 2025-06-23 17:36:03 +09:00
parent dfef7a622f
commit 0cb0f9303d
2 changed files with 9 additions and 8 deletions

View File

@ -15,7 +15,6 @@ namespace WelsonJS.Launcher
private string entryFileName;
private string scriptName;
private const string timestampFormat = "yyyy-MM-dd HH:mm:ss";
private static MetadataStore metadataStore;
public InstancesForm()
{

View File

@ -105,20 +105,22 @@ namespace WelsonJS.Launcher
Api.JetAddColumn(_session, tableid, col.Name, coldef, null, 0, out _);
}
string indexName = "primary";
string indexKey = $"+{_primaryKey}\0\0"; // Primary key ASC
string indexKey = $"+{_primaryKey.Name}\0";
int keyLength = Encoding.ASCII.GetByteCount(indexKey + "\0"); // double null-terminated
string fullKeyDescription = indexKey + "\0";
Api.JetCreateIndex(
_session,
tableid,
indexName,
"primary",
CreateIndexGrbit.IndexPrimary | CreateIndexGrbit.IndexUnique,
indexKey,
indexKey.Length,
100);
fullKeyDescription,
keyLength,
100
);
Api.JetCloseTable(_session, tableid);
Api.JetCommitTransaction(_session, CommitTransactionGrbit.None);
Api.JetCloseTable(_session, tableid);
}
private void CacheColumns()