• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data class inconsistencies

 
Lukasz Racon
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic