• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Bug with Data.java - Urgent

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic