Hi all,
I have one doubt about reading the records from the database.
I have one class Database that reads the record from my .db file. And My Data class works with this Database object. Data class don�t read the records from the .db file directly it call the method of the Database class instance that reads the record. All access to the db file will be made from Database. Every record will be wrapped in the Record class.
I use also DataSchema, class that reads the header of the database and have some information about the length and names of the records� fields. All information about the length an field�s name will be built dynamically. But now I have one doubt how to read one records and write it to the object Record, how to make it more dynamically?
I have one method readRecordAt(int recNo) in the Database class.
With the following context:
And now I try to fill the fields of the Record with the data.
this will called the method setValue(int,
String) from Record class:
the readDB(byte[]) reads the information from the database (RandomAccessFile) and convert the byte array to String.
How do you think about it?
I have another idea don�t use the Record object. And store every records as one Array of String.
How do you think what is the best way to do this?
Do you have other ideas? Are there another way to fill the Record object more dynamically?
Thanks a lot for your help and comments!