• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Record No Vs Flight Number

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I tried to create a table out of the binary file db.db to look at the data to start with and i am getting confused with Record Number and Flight Number are they same or they are talking about
Physical record number of the record in the file which has got nothing to do with the flight Number
Please Reply
Farouk
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are both different. Record Number looks like it is related to the order they are in the file, and flight number is created by the airlines.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Do you mean to say record Number is present in the file with a value?
Farouk
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The comments provided by sun for find(String) states
* This method searches the database for an entry which has a first field which exactly matches the string supplied. If the required record cannot be found, this method returns null. For this assignment, the key field is the record number field.
@param toMatch The key field value to match upon for a successful find.
* @return DataInfo The matching record.
Please can anyone tell me why they are mentioning the first field as record number field when the database has got no record Number field and flight ID is the first field
Please reply
Farouk
record Number Field
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Farouk:
You raise an interesting issue. It struck me too and I assumed that it is a typo and that the comments should actually say
For this assignment, the key field is the flight number field.
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks for the information thomas, I would say sun has deliberately provided the comment juct to confuse the develoepr and make him think about it.Anyway after analysing the requierments I have decided to hide Record Number from the user interface, database (file) expose only flight Number as a primary key.
I think record number is a implementation aspect of using files
for processing records as you can infer from Data Class and Data Info Class.
My design of neglecting record Number is valid in the sense it decouples user interface from database implementation say if in future if the file is converted to a database, flight ID still holds valid as a primary key.
You comments on this please
Farouk
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually the find method takes a string to match the Flight Number, which is the first field. Record Number is not a field in the database, but just a numbered location of the record.
They are two different things
For instance I could give you a list of flight numbers as in
Flight #
456
384
567
342
132
record number 3 is the one with Flight #567
so if I called find(String) i would call find("567")
but if I wanted to lock the record I would call lock(3)
Does that clear things up at all?
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark
Thanks for the reply. I understand what you mean by that , can you please comment on my design view of handling fly by night
After analysing the requirements I have decided to hide Record Number from the user interface and database (file at the moment does not have record number) expose only flight Number as a primary key.
I think record number is a implementation aspect of using files
for processing records as you can infer from Data Class and Data Info Class.
My design of neglecting record Number is valid in the sense it decouples user interface from database implementation say if in future if the file is converted to a database, flight ID still holds valid as a primary key.
You comments on this please
Farouk
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can agree on you with that. Record Number is more of a poitner, as Flight Number is close to a Primary Key. However, if you go to the Primary Key use, you might need to include Airline as part of the primary key. Because what happens in the future, if two airlines have the same flight number?
While in real life, we would be better to have a unique "Synthetic" id, auto incremented for us. In this project, for making things a little simpler, they are using Record Number as this key. I think changing that for this exam is going beyond the scope of what you need to do to get a good passing mark.
Still the user interface, the one the user sees, should not have any visual reference to record number.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark
I think you have missed the clue provided by sun on the add record method. According to them when they try to add a record and if the primary key contains the key or the record we are trying to add then it will throw a database Exception ("Attempt to add a duplicate key").
For me this is the confidence i think it is a design decision taken by the designer of this model and we should follow it.
And for your real world consideration ,according to me flight information is a shared information so many airlines contribute for this information and there are defintely standards for airlines follow before you come up with a flight ID. If you start thinking that way even for criteria find method say a user searches with IND as a origin if it can mean INDIA or INDIANA we will be all in soup
Your comments please
Farouk
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go ahead and add any records you want. That is not needed for this assignment.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark
Sorry I think you misunderstood me. What I refered to in the add record method is to convey the fact that flight ID is a primary key. Your reply was blunt so i would like to clear myself
Farouk
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I agree that is correct. I think flight ID is the primary key too
Sorry.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic