Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

URLyBird's [Version 1.2.3] : create/update/delete

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more question on Create and delete method.


For my create method..
- I am not looping through my current records to find delete records, to insert this new record. I just create a new record.
- I also assume that data [input] array for createRecord and updateRecord method does not contain delete flag..when I create record, i add delete flag = 00.and for update method, i just leave delete field alone.

specs says..
// Creates a new record in the database (possibly reusing a
// deleted entry). Inserts the given data, and returns the record
// number of the new record.
public long createRecord(String [] data)
throws DuplicateKeyException;

it says "possibly reusing "..am I gona loose points if i do not reuse the delete field. I did not reuse the delete record b/c what if in the future
they want reuse that record..??

Now delete specs says reuse..I do not see "possibly reusing ".. // Deletes a record, making the record number and associated disk
// storage available for reuse.
// Throws SecurityException if the record is locked with a cookie
// other than lockCookie.
public void deleteRecord(long recNo, long lockCookie)
throws RecordNotFoundException, SecurityException;

Thank you..
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Payal,
Don't worry about reusing a deleted record. It's not a requirement, just a hint.
For the delete method, it is just said that the record is now available and not it must be used for a new record. It's my interpretation ...
However, implementing that functionality could improve your score (may be !).
Anyway, explain your choice in your choices.txt
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also depends on what you do in your delete method. You can simply mark the delete flag to 1 and leave the data intact, or change delete flag and write a empty array to make the row empty. Also you will need to take into consideration of these deleted rows when calculating the number of records. If delete flag=1, is it a record or not?
 
Payal Shah
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic