sorry when i said limited i meant mobiles compared to computers. allow me to explain in less painful details. i spent 30minutes preparing this so i hope it helps
online database has a table of 4 fields: username, name, age, country. the images of every user are stored there as well. the imagename = name of user. so my name is leo therefore my image is leo.jpg
mobile app:
first class is USERS class. in it are 4 declared strings = 4 fields in the database + recordID string
first vector is USERS vector
second vector is IMAGES vector
third vector is NAMES vector
first rms is USERS rms
second rms is IMAGES rms
now for my process:
1- i download the data online. first record is wildheart25c, leo, 19, US
2- i save these 4 strings in a record in USERS rms
3- i create an object of type USERS and save this info in it along with the recordID which i get fromt he previous step
4- i insert this object in USERS vector
5- i insert the name string in the NAMES vector
6- repeat processes 1-5 until all the records have been downloaded
7- i download the images using a for loop. the following steps are what happen inside the for loop
8- save the image in a record in the IMAGES rms
9- insert the image in IMAGES vector
10- repeat until i > NAMES.size();
example just to b sure you're with me so far
online db:
wildheart leo 19 US
maximus tim 19 US
mobile app:
NAMES vector has leo and tim
IMAGES vector has leo.jpg and tim.jpg
USERS vector has obj1 and obj2 where each obj has info about each user and their recordID
Searching:
i access each object in the USERS vector looking for a certain field value like age=19. if i found it in index0 of USERS vector, then i load the image in index0 in the IMAGES vector
Deleting:
access each obj until you find the name you want to delete. when you find it, the obj contains the recordID. use that ID to access the USERS and IMAGES rms and delete that record
Insert:
this means downloading new records. the processes have already been explained
Update:
this means downloading updated records. exiting records with new information. i access each obj until i find the username, change the info in that object, then use the recordID to access the record in the USERS rms to change the info. same goes for the image if there's a new image.
This is what i did and iv tested it on 4 records. no problems. BUT i asked myself if having 2 vectors is a good idea. i have 4 records only. What if i was downloading 100 new records and 20 updated records? would two vectors be a good idea performance and storage wise? and w/e else factor that affects a mobile
So i turned to hashtables. There are two ways to do this using hashtables.
1) 4 fields therefore 4 hashtables. the key is the recordID and the value is each of the 4 strings. So i'll have a hashtable for username, another for name, anther for age and another for country. then a 5th hashtable for the image where the key is the recordID and the value is the image itself.
2) One hashtable. the key is the users object. the value is the image. or the key is one string ("wildheart-leo-19-US") and the value is the image. Either way when searching and updating i'll have to access each obj/string to find what i want. Ths cancels the idea of using a hashtable because im going through every key until i find the one i want which is pretty much the same as going through a vector
Bare in mind that i dont no which sort algo to use. so w/e method you recommend, bare in mind the sort algo that goes with it.
There. I hope this helps. Sorry again.