Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Junk Characters displayed after setting Delete flag - Bodgitt & Scarper 2.2.3

 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am back after a long time . I have started implementing delete method which has been defined by Sun Interface. My interface comments are
1 byte flag. 00 implies valid record, 0xFF implies deleted record . As per spec, I have written 255 i.e FF in the db file successfully while deleting the particular record. I found the following bold character

ÿBitter Homes & Gardens in the file after deletion . Any idea?


sat
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe a code snippet of the code you use to delete the reocrd (and write the delete flag) would be helpful
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

satishkumar janakiraman wrote:I found the following bold character

ÿBitter Homes & Gardens in the file after deletion . Any idea?



Partner, what did you use to read the .db file? A normal text editor?
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roel and Roberto,

I appreciate your response. Here is the sample code,


Here fileHandler indicates the RandomAccess File,
loc indicates the delete flag position in the db file.
and deleteFlag indicates the integer value 255.

I used a free hexeditor not a text editor.

sat

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, that is the deleted flag (oxFF) isn't it? I mean, when you read it back, you are casting the value to a char and writing it to the screen.
 
Roberto Perillo
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Satishkumar!

Partner, were you able to find your problem? I created a simple tool that reads the database file (you can find it here). Try using it to see if you really have something weird in your .db file.
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg,

Yes it is a delete flag. I am able to set/get the value 255 to/from db. Please look at the attachment, I see a junk value in front of Bitter Homes & Gardens. I would like to confirm whether this is correct or incorrect

Hi Roberto,

Thanks for providing me a link to your tool. Please have a look at the attachment. DB has a junk character in front of Bitter Homes & Gardens. I am not sure whether this is correct


sat
Delete_Flag-in-DB.jpg
[Thumbnail for Delete_Flag-in-DB.jpg]
Junk Characters in db after setting delete flag
 
Greg Mandel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just check the database design section in the instructions, it explains the format of the data.
    Bookmark Topic Watch Topic
  • New Topic