Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

NX: Flag help

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The INVALID flag for a deleted record is 0X8000, which is 32768. A short in Java goes to 32767. This flag is 2 bytes in the database. Shouldn't it be a int, using 4 bytes; the compiler won't take this:
private static final short INVALID = 0X8000;
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,
Try this:

Regards,
Phil.
 
Jim Thompson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Why isn't the flag an int instead of a short? Why 2 bytes?
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,

Originally posted by Jim Thompson:
Why isn't the flag an int instead of a short? Why 2 bytes?


Why even two bytes? It should be one byte (as it was in the database file I had for my assignment). Actually a flag can be represented in a single bit, so even a single byte is ample. I suspect they vary the size of the flag so that there are different versions of the assignment. I guess this is so one can't just take a solution to one of the assignment versions and have it work correctly with the database file from another version.
reply
    Bookmark Topic Watch Topic
  • New Topic