|
| Re: RMS problem |
 |
Thu, 17 Nov 2005 11:14:30 -000 |
Quoting from the Javadoc for the RecordEnumeration class.
"If, while indexing through the enumeration, some records are deleted from
the record store, the recordId's returned by the enumeration may no longer
represent valid records"
I imagine this is the cause of your problem, the enumeration becomes
inconsistent with the actual records stored. Maybe you need to call the
rebuild() method somewhere.
Regards
Martin
"yafy" <yafy@inv.com> wrote in message
news:n%230HXA06FHA.1008@extapps30...
> hi folks,
>
> Actually im saving some strings for my appln to templates.db using RMS
> ,where im creating,updating,deleting the content of RMS.Creating new one
and
> updating are working fine.But when i try to delete any item ,first time
its
> deleting correctly.Next time onwards it starts throwing
> InValidRecordIDException ,so not deleting from RMS. :confused:
>
> Plz have a glance at the snippet:
>
> try{
> RecordStore recordStore =
> RecordStore.openRecordStore("templates",true); //
"false" is also not
> working.
> RecordEnumeration re = null; int recid=1;
> re = recordStore.enumerateRecords(null,null,true);
>
> if(recordStore.getNumRecords()>0)
> {
>
> while(re.hasNextElement())
> {
> recid=re.nextRecordId();
> if(recid==index1) //index1 is get at
> runtime
> recordStore.deleteRecord(recid);
> }
> }
>
>
> recordStore.closeRecordStore();
>
> }catch(Exception e){
> System.out.println("deleteTemplate exp: "+e);}
> }
>
> I search some of the threads regarding RMS in Forums ,but not useful to my
> case. Plz suggest some ideas to resolve this excp.
>
> Thanks in Advance.
>
> Regards
> yafy.
>
>
|
| Post Reply
|
| RMS problem |
 |
Thu, 17 Nov 2005 12:02:48 +053 |
hi folks,
Actually im saving some strings for my appln to templates.db using RMS
,where im creating,updating,deleting the content of RMS.Creating new one and
updating are working fine.But when i try to delete any item ,first time its
deleting correctly.Next time onwards it starts throwing
InValidRecordIDException ,so not deleting from RMS. :confused:
Plz have a glance at the snippet:
try{
RecordStore recordStore =
RecordStore.openRecordStore("templates",true); // "false" is
also not
working.
RecordEnumeration re = null; int recid=1;
re = recordStore.enumerateRecords(null,null,true);
if(recordStore.getNumRecords()>0)
{
while(re.hasNextElement())
{
recid=re.nextRecordId();
if(recid==index1) //index1 is get at
runtime
recordStore.deleteRecord(recid);
}
}
recordStore.closeRecordStore();
}catch(Exception e){
System.out.println("deleteTemplate exp: "+e);}
}
I search some of the threads regarding RMS in Forums ,but not useful to my
case. Plz suggest some ideas to resolve this excp.
Thanks in Advance.
Regards
yafy.
|
| Post Reply
|
| Re: RMS problem |
 |
Fri, 18 Nov 2005 07:49:55 +053 |
Thanks Martin
I tried rebuild ,immediately after the if loop.Now InvalidRecordIDExp is not
thrown.But as usual ,record is not deleted frm RMS.Plz suggest where(in
which line) ,i ve to put rebuild() in order to orginally delete records frm
RMS.
plz help me.
thanks in advance
Regards
yafy.
"Martin" <martin@dummy.address> wrote in message
news:4lxlvd26FHA.1008@extapps30...
> Quoting from the Javadoc for the RecordEnumeration class.
>
> "If, while indexing through the enumeration, some records are deleted
from
> the record store, the recordId's returned by the enumeration may no longer
> represent valid records"
>
> I imagine this is the cause of your problem, the enumeration becomes
> inconsistent with the actual records stored. Maybe you need to call the
> rebuild() method somewhere.
>
> Regards
> Martin
>
>
> "yafy" <yafy@inv.com> wrote in message
> news:n%230HXA06FHA.1008@extapps30...
>> hi folks,
>>
>> Actually im saving some strings for my appln to templates.db using RMS
>> ,where im creating,updating,deleting the content of RMS.Creating new
one
> and
>> updating are working fine.But when i try to delete any item ,first
time
> its
>> deleting correctly.Next time onwards it starts throwing
>> InValidRecordIDException ,so not deleting from RMS. :confused:
>>
>> Plz have a glance at the snippet:
>>
>> try{
>> RecordStore recordStore =
>> RecordStore.openRecordStore("templates",true); //
"false" is also not
>> working.
>> RecordEnumeration re = null; int recid=1;
>> re = recordStore.enumerateRecords(null,null,true);
>>
>> if(recordStore.getNumRecords()>0)
>> {
>>
>> while(re.hasNextElement())
>> {
>> recid=re.nextRecordId();
>> if(recid==index1) //index1 is get at
>> runtime
>> recordStore.deleteRecord(recid);
>> }
>> }
>>
>>
>> recordStore.closeRecordStore();
>>
>> }catch(Exception e){
>> System.out.println("deleteTemplate exp: "+e);}
>> }
>>
>> I search some of the threads regarding RMS in Forums ,but not useful to
>> my
>> case. Plz suggest some ideas to resolve this excp.
>>
>> Thanks in Advance.
>>
>> Regards
>> yafy.
>>
>>
>
>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|