This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bug with Data.java - Urgent

 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team
There seems to be a bug with add(DataInfo[]) method of Data.java. This method first check whether the flight number of the new record to be added already exist in the db.db. If not found it invokes writeRecord(String[] newData) method where the new values are inserted in the db and the values which has larger length than required by Data, they are truncated.
The problem is that suppose there is already a record with flight number="SINGA" in the db.db
Now if we try to add a record with flight number "SINGAPORE-27", by invoking the add() method, then it will not find the flight number "SINGAPORE-27" in database. Thus then writeRecord() method will be invoked. Now since the length of flight number string to be added "SINGAPORE-27" is larger than expected, thus it will be truncated to "SINGA" only and then inserted into database. Thus now the database have duplicate flights.
How to overcome from this probelm ???
Pls Help
I need to upload the assignment in 1-2 days
Amit
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Amit,
Don't worry about it. You must assume that the database guys are aware of the constraints and besides, there is no need for you to call add() in the first place. I don't know of anyone who has concerned themselves with what you point out may be a flaw in the database schema. So just relax and make sure your client and server do what they're supposed to do.
Hope this helps,
Michael Morris
 
Mike Piotrowski
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit,
I would say also don't worry about it. You never need to call the add method anyways in the assignment. This may be something you might want to point out though in your desing document.
Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic