Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi all,

Iam new in brew.Iam trying to create a datbase in Brew.But when calling IDATABASE_CreateRecord() application hangs.

I use Eclipse with gcc compiler for compiling.Iam using Brew3.1.5 emulator.

Following are my source code.

static void create_DB(PEPlus * pMe)
{
IDBRecord * pIDBRecord;
AEEDBField pDBFields[3];
IDBMgr * pDBMgr = NULL;
if(ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_DBMGR, (void**) (&pDBMgr)) != SUCCESS)
{
DBGPRINTF("if(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_DBMGR, (void**)(&pDBMgr)) NOT SUCCEES");

else
{
DBGPRINTF("Created");
}
const char * pszFile = "DBFile";
// uint16 record_ID;
pDBFields[0].pBuffer =(char *) MALLOC (160 * sizeof(char));

DBGPRINTF("****** START *******");

pMe->m_pDatabase = IDBMGR_OpenDatabase(pDBMgr,pszFile,TRUE);

if(! pMe->m_pDatabase)
{

DBGPRINTF("Error opening database...");
if (pDBMgr != NULL)
IDBMGR_Release (pDBMgr);
return;

}

DBGPRINTF("****** DB Created *******");
char * str= "BREW";
pDBFields[0].fType = AEEDB_FT_STRING;
pDBFields[0].fName = AEEDBFIELD_TEXT;
pDBFields[0].wDataLen = STRLEN(str);
(char *)pDBFields[1].pBuffer = "BREW1";
//strcpy((char *)pDBFields[0].pBuffer,temp_buffer);
pDBFields[1].fType = AEEDB_FT_STRING;
pDBFields[1].fName = AEEDBFIELD_TEXT;
//pDBFields[1].wDataLen = STRLEN(temp_buffer);
pDBFields[0].wDataLen = STRLEN(str);
(char *)pDBFields[1].pBuffer = "BREW2";
DBGPRINTF("****** Before CREATE *******");
DBGPRINTF("Character in %s",(char *)pDBFields[1].pBuffer);
pIDBRecord = IDATABASE_CreateRecord(pMe->m_pDatabase,pDBFields,2);
DBGPRINTF("****** END *******");
//return pMe->pIDatabase;

}

Regards
Premlal