You Are Here:

Community: Developer Discussion Boards

#1 Old RMS help needed! - 2009-05-10, 10:19

Join Date: Nov 2007
Posts: 191
jackofall
Offline
Regular Contributor
I am storing login and password info as two strings.
but when user try to change its login or password,i need to store that data in next place.( i can't overwrite )
According to the documentation of deleteRecord(int recordid) method,we can't use this id again.
So, that's mean,whenever user try to change this info,it will be written at new place and i need to compare a different record id to validate user info for login.
Can we overwrite the data or can we store data at
record id(1)=login
record id(2)=password
every time .
Thanks for your time!
Regards!
Reply With Quote

#2 Old Re: RMS help needed! - 2009-05-10, 10:50

Join Date: Jun 2007
Posts: 534
Location: Mumbai
Send a message via Yahoo to prakash.raman
prakash.raman's Avatar
prakash.raman
Offline
Super Contributor
Hi,
have u tried useing "setRecord(int recordId, byte[] newData, int offset, int numBytes)". You don't need to call deleteRecord(), just set the new login , password data at particular record id.


au revoir
Prakash Raman
Reply With Quote

#3 Old Re: RMS help needed! - 2009-05-10, 10:58

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Online
Forum Nokia Champion
Why can't you overwrite?

I'd recommend you put both pieces of information in the same record, and that you update that record when the details change.

PHP Code:
private static void saveLogin(String usernameString passwordthrows RecordStoreException {
    
byte[] data;
    try {
        
ByteArrayOutputStream bout = new ByteArrayOutputStream();
        
DataOutput dout = new DataOutputStream(bout);

        
dout.writeUTF(username);
        
dout.writeUTF(password);
        
dout.flush();

        
data bout.toByteArray();
    } catch (
IOException e) {
        
// won't happen, because we're using a ByteArrayOutputStream
    
}
        
    
RecordStore rs RecordStore.openRecordStore("login"true);

    try {
        if (
rs.getNumRecords() == 0) {
            
rs.addRecord(data0data.length);
        } else {
            
rs.setRecord(1data0data.length);
        }
    } 
finally {
        
rs.closeRecordStore();
    }

Graham.
Reply With Quote

#4 Old Thumbs up Re: RMS help needed! - 2009-05-11, 06:52

Join Date: Sep 2008
Posts: 1,195
Location: DELHI
Send a message via Yahoo to jitu_goldie
jitu_goldie's Avatar
jitu_goldie
Offline
Forum Nokia Champion
When login recordstore is empty then use addrecord else when want to overwrite the previous inforation then just use setRecord() function as graham suggests.


thanks,
jitu_goldie..

KEEP TRYING..
Reply With Quote

#5 Old Re: RMS help needed! - 2009-05-11, 07:15

Join Date: Nov 2007
Posts: 191
jackofall
Offline
Regular Contributor
Thank you guys,

"setRecord(int recordId, byte[] newData, int offset, int numBytes)"

This solved my problem.
Cheers
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
RMS data LOST problem in 3410!!! bitsonic Mobile Java General 6 2009-03-27 10:50
newbie : Writing RMS entry at Installation time--approx 200kb RMS data & 30k appsize. raxitsheth Mobile Java General 8 2008-07-27 04:30
RMS record sizes. earamsey Mobile Java General 1 2007-10-18 14:51
Minimum Physical Memory Needed by RMS? walkal Mobile Java General 0 2004-03-17 02:55
7210 & 7250 RMS resetting problem keithmcneill Mobile Java General 1 2003-11-13 22:04

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia