• 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

recNo

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the spec we have various methods that take an int recNo as argument. Problem is that the database does not contain a record number field so does the recNo refer to the sequentially placed record in the database?

In other words does recNo = 5 refer to the fifth record? Further, could this not be interpretted as being the 6th record if we count from 0?
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could do it either way I guess once you justify it. I suppose the most user friendly way would be to start record counting from one, although it makes things a slightly more complex (messy even?) in the data class
[ November 21, 2006: Message edited by: Mark Smyth ]
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Mark will do it from 1
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The end user doesn't have to know anything about the record number.
For the Java developer it makes more sense starting them from 0 because everything else in Java does (trust me, I worked for 3 years in a company where we had to mix Java with a custom language that used 1 based arrays, it was a constant headache to remember which method calls used 1 based indices and which used 0 based indices).
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though we are used to arrays starting at zero I think that the Data class should be seen as some kind of a database interface and if you check java.sql.ResultSet this interface states that the counting start at 1.

Regards,
Kalle
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, which goes counter to everything else in Java
See it better as a call to a mainframe where you're in control of both the mainframe and the client.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic