×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    [RMS] foreign key

    Hello

    is there any way to save in a given record something similar to foreging key, or some pointer to another record?

    thanks in advance

  2. #2
    Regular Contributor
    Join Date
    Nov 2010
    Location
    Egypt,Mansoura
    Posts
    80

    Re: [RMS] foreign key

    No, There is no way to get the number of the record in the j2me . But, there is a trick to get it and get or set any record u want.

    Code:
    // in the constructor of Your Midlet u can add this Vector (which will contain the records id s" some This like Forign Key "
    
          private Vector IDs=new Vector();
    
    // and first time u called the db to enumeration you can make a While loop to set the recods ids in the Vector
    
          while(records.hasNextElement()){
                      
                    IDs.addElement(records.getid);
    }
    
    // do the previous in try catch block
    
    // and when u want to get record from specify id by using this way
    // if u want for example get what in the first record which is equal to '0' 
    
                    int id=((Integer)IDs.ElementAt(0)).intValue():
    
    // then u can use getRecord(int id) void to get the record in'0'
    i hope it works fine with u

    inform me if not

    BUFFON
    Let The Impossible Happen!!!

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: [RMS] foreign key

    well, this is not exactly what I'm looking for, what I want to do is to somehow connect two records, but no like concatenation into one, but via the "link" some pointer or sth like this

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: [RMS] foreign key

    When you create a record with addRecord(), the record number is returned. The record number is effectively the "primary key", so can be used as a foreign key if you store it in another record.

    If you need to know the number of the record you're about to add, you can use getNextRecordId(). If you do this, be careful not to add records from multiple threads.

    In the wiki, there is some useful information on using RMS.

    Graham.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: [RMS] foreign key

    ok, but how to do this automatically? I mean, for example user creates his/her profile and then there is an next record created [ somehow connected with the profile one ] with his/her data

    btw great forum, quick and usefull responses, glad I found You = )

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: [RMS] foreign key

    It won't happen automatically for you.

    It's important to remember: RMS is not a relational database engine.

    I'd suggest you think about it differently. For example, put all the data in one record.

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: [RMS] foreign key

    that's what I thought. Is there any sql based db on the j2me?

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: [RMS] foreign key

    No, I'm afraid not.

    You might be interested to read this thread.

    Graham.

Similar Threads

  1. Primary and foreign key in e32db
    By v divya in forum Symbian
    Replies: 7
    Last Post: 2009-03-17, 03:42
  2. Database:primary key-foreign key relation
    By remyag in forum Symbian
    Replies: 4
    Last Post: 2008-07-16, 10:27
  3. DBMS foreign key ?
    By lucca99 in forum Symbian
    Replies: 2
    Last Post: 2007-05-03, 19:13
  4. Do we have "foreign key" in Symbian DBMS?
    By arachidyl in forum Symbian
    Replies: 2
    Last Post: 2006-03-16, 11:08
  5. RMS hasn't saved when prog closed with the red key
    By esteinitz in forum Mobile Java General
    Replies: 2
    Last Post: 2003-08-29, 09:50

Posting Permissions

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