• 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

Data class inconsistencies

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have constructors assignment, which is "real" project with many inconsistencies
First quote:
"""public long createRecord(String [] data) throws DuplicateKeyException;"""
Question:
I don�t have specified what means "Duplicate Key" do you check whether all fields match exactly another record??, or you never throw this error?
Second quote:
"""All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field."""
Main problem here is that the strings in database file are not null terminated, but rather whitespaced (0x20). Am I missing something? AFAIK null != ' '
Right now I am trimming the string to get rid of whitespaces, but when some
will use null values I might have a problem.
thanks for ideas and help,
Lukasz
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lukasz,
Welcome to this forum.

Question:
I don�t have specified what means "Duplicate Key" do you check whether all fields match exactly another record??, or you never throw this error?


The DuplicateKeyException issue has been fully discussed recently. A search on this forum with the keyword "DuplicateKeyException", should bring you useful answers.

Main problem here is that the strings in database file are not null terminated, but rather whitespaced (0x20). Am I missing something? AFAIK null != ' '


Existing strings in the db file right-padded with spaces don't contradict our specs IMO because 0x20 is a "normal" character. Those strings are null-terminated, but as the field values fully use the field length, there is no 0x00 character. Trimming the strings read sounds reasonable. But I would handle the possible 0x00 characters anyway both when reading and writing.
Best,
Phil.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic