brew database | developer.brewmp.com brew database | developer.brewmp.com

Developer

brew database

Forums:

hellow all

i am working with BREW 3.1.4 and i want to know can we store & retrive the data of two structures (two tables) in one database file ?.
Basically problem is............

first structure

typedef enum
{
DB_RECORD_FIELD_NAME = 0,
DB_RECORD_FIELD_ALTNUM,
DB_RECORD_FIELD_ADDRESS,
DB_RECORD_FIELD_AMOUNT,
NUM_INFODB_RECORD_FIELDS
EDBRecordInfoFieldType;

second structure

typedef enum
{
DB_RECORD_FIELD_SWITCHRASED= 0,
DB_RECORD_FIELD_TXT_SWITCHRASED,
DB_RECORD_FIELD_LOCKKEY,
DB_RECORD_FIELD_PWD,
DB_RECORD_FIELD_RASED_KEYCOMBO,
DB_RECORD_FIELD_KEYPADLOCK,
DB_RECORD_FIELD_KEYPADLOCK_TIME,
DB_RECORD_FIELD_REBOOT,
NUM_DBGENSET_RECORD_FIELDS

}EDBGenSetRecordFieldType;

i managed to store the data for above field in one database file (app_db).
but when i try to retrive the data for second structure i got error message (unhandled exception).
The code snippet for retriving data is:

while( (pRecord = IDATABASE_GetNextRecord( pMe->m_pDatabase )) != NULL )
{
// Get the first field
IDBRECORD_Reset(pRecord);
while(IDBRECORD_NextField( pRecord, &rFieldName, &nFieldLen )!= AEEDB_FT_NONE )
{
// Get the contents of this field
pData = IDBRECORD_GetField( pRecord, &rFieldName,
&rFieldType, &rFieldLength );
if (!pData)
break;
switch( rFieldName )
{
case DB_RECORD_FIELD_SWITCHRASED:
// Set the List type if pSwitchItem is a valid pointer
if( pSwitchItem )
*pSwitchItem = *IDBRECORD_GetField( pRecord, &rFieldName, &rFieldType, &nFieldLen );
break;

case DB_RECORD_FIELD_TXT_SWITCHRASED:
// Set the SMS txt if pSMSTxt is a valid pointer
if( pSMSTxt )
{
pSMSTxtPtr = IDBRECORD_GetFieldString( pRecord );
WSTRCPY( pSMSTxt, pSMSTxtPtr );
}
break;

case DB_RECORD_FIELD_LOCKKEY:
// Set the List type if pLockey is a valid pointer
if( pLockey )
*pLockey = *IDBRECORD_GetField( pRecord, &rFieldName, &rFieldType, &nFieldLen );
break;

case DB_RECORD_FIELD_PWD:
// Set the password if pPWord is a valid pointer
if( pPWord )
{
pPWordPtr = IDBRECORD_GetFieldString( pRecord );
WSTRCPY( pPWord, pPWordPtr );
}
break;

case DB_RECORD_FIELD_RASED_KEYCOMBO:
// Set the description if pKeyCombo is a valid pointer
if( pKeyCombo )
{
pKeyComboPtr = IDBRECORD_GetFieldString( pRecord );
WSTRCPY( pKeyCombo, pKeyComboPtr );
}
break;

case DB_RECORD_FIELD_KEYPADLOCK:
// Set the List type if pKeypadLoc is a valid pointer
if( pKeypadLoc )
*pKeypadLoc = *IDBRECORD_GetField( pRecord, &rFieldName, &rFieldType, &nFieldLen );
break;

case DB_RECORD_FIELD_KEYPADLOCK_TIME:
// Set the description if pLockTime is a valid pointer
if( pLockTime )
{
pLockTimePtr = IDBRECORD_GetFieldString( pRecord );
WSTRCPY( pLockTime, pLockTimePtr );
}
break;

case DB_RECORD_FIELD_REBOOT:
if( pReboot )
*pReboot = *IDBRECORD_GetField( pRecord, &rFieldName, &rFieldType, &nFieldLen );
break;
default:
break;
}
}
// Release the record
IDBRECORD_Release( pRecord );
}
Is there anything wrong in code. or i have to maintain two seperate database file each for a structure.

pls if u have any idea then share it.
thanks
ketan