• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

updateRecord method

 
Mary John
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have just written the updateRecord method, to basically do the writing part. Given the data array, write to the file at the specified position.

But after coding I find it looking too simple to me, I mean compared to Andrew's SCJD book. There I find an empty record string, then an inner class being used. So I think I am overlooking some thing that is needed.

Can anyone give some feedback on this piece of code. Locking and exceptions are not dealt with as of now.


I have made sure that it writes ok and can read it correctly back with my raed method. But it looks too simple. ? what do you think compared to your codes...?

Thanks, any feedbacks please...
Mary
[ March 17, 2008: Message edited by: Mary John ]
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Mary,

-what if your data[i] is longer or shorter what your database needs?
-what if the recNo does not exist, or has it's deleted flag already set?

Herman
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;

also

raf.write(out.toString().getBytes());


- what the encoding getBytes() will used ? , i think it will use the default OS encoding schema.

Regards.
Mohamed Darim.
 
Mary John
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies Herman and

I never thought of these situations.

I assumed that the GUI client have the records already displayed and user will change the required fields. so when this occurs we can create a string[] array with the new and old values.

Are we required to handle situations with null values in the data array. (or could we specify that data cannot have nulls in it??)


what if your data[i] is longer or shorter what your database needs?

any suggestions to this one? What I think is, I would ignore data array longer that what is required and if it shorter than that required then I would just update that much to the record.....
what did you do?

Thanks in advance.
Mary
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic