Actor and IDatabase | developer.brewmp.com Actor and IDatabase | developer.brewmp.com

Developer

Actor and IDatabase

Hello everyone,

I am having this weird problem and perhaps someone has seen this problem as well. I have an UIOne applet with multiple actors. Here is the code snippet that I use:
IDBMgr* pDBMgr = NULL;
IDatabase* m_pDatabase = NULL;
int i = ISHELL_CreateInstance(this->GetIShell(), AEECLSID_DBMGR, (void**)(&pDBMgr));
m_pDatabase = IDBMGR_OpenDatabase(pDBMgr, "fs:/~/temp.db", TRUE);
RELEASEIF(pDBMgr);

IDBRecord* pRec = NULL;
AEEDBField fields[2];

uint32 n = IDATABASE_GetRecordCount(m_pDatabase);

fields[0].fName = 0;
fields[0].fType = AEEDB_FT_DWORD;
fields[0].pBuffer = (void*)&n;
fields[0].wDataLen = sizeof(uint32);

fields[1].fName = 1;
fields[1].fType = AEEDB_FT_STRING;
fields[1].pBuffer = (void*)L"HELLO";
fields[1].wDataLen = 5 * sizeof(AECHAR);

pRec = IDATABASE_CreateRecord (m_pDatabase, fields, 2);
RELEASEIF(pRec);
RELEASEIF(m_pDatabase);The problem is, this code will work fine in actor1. However, this same code snippet will crash when IDATABASE_CreateRecord() in actor2. Did anyone else see the problem? At first, it was the permissions in the MIF. But thats impossible since the permissions are inherited from the applet. So the two actors (actor1 and actor2) should have the same permissions.

Any ideas or suggestions will be appreciated!

Hi Rock
I think you should make following change to your code (or use WSTRSIZE), maybe it will help
fields[1].wDataLen = 6 * sizeof(AECHAR);

Hi Rock
I think you should make following change to your code (or use WSTRSIZE), maybe it will help
fields[1].wDataLen = 6 * sizeof(AECHAR);