• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRecordCount()

 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently Data.getRecrodCount() returns the total number of records (including all the deleted ones). Has anybody provided a new implmentation of the method, that returns the "logical" number of records, which is really what any user of this public method is interested in.
Does anybody think that changing this will screw up the way the database works ? I dont think so, but haven't looked into it in detail yet.
Also what are your opinions on calculatung the "logical" record count in the constructor, and then adjusting this everytime the delete method is called, compared with iterating through the database every time getRecrodCount is called ?
cheers, dean
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, since the latest version of the assignment has no requirements for deleting, then the record count will be correct of all undeleted records. So no you don't need to create a new implementation of that method.
Hope that helps
Mark
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mark, thanks for your advise
so in my getFlights method, where i construct my String[][] that populates the JTable. I can initalise the array using getRecordCount, and when calling getRecord i need not check that the DataInfo returned is not null ?
Thanks, Dean
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and when calling getRecord i need not check that the DataInfo returned is not null ?

Well you can still do that
Mark
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mark,
quote:
--------------------------------------------------------------------------------
and when calling getRecord i need not check that the DataInfo returned is not null ?
--------------------------------------------------------------------------------
Well you can still do that

i feel that by writing some code to support the fact that records may have been deleted (ie checking that the DataInfo object is not null) you also need to initialise the String[][] that populates the JTable with the correct record count.
If I was only to check that a record is not null without using the logical record count to inmitialise the array, I would end up with empty rows in my JTable.
Do you think this is OK?
I suupose all I need to do in the table selection listener, is check that the recrod number that i am expecting to recieve from the selection is not blank or null, and if it is just do nothing.
Thanks a lot for your advise throughout my assignment Dean
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I had said, I didn't check for deleted records, and it worked fine for me.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic