• 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

B&S 2.2.1 Data File Null Terminated Fields???

 
Ranch Hand
Posts: 100
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I'm doing the final read through of everything before submitting and I've noticed that the data file is described as...

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.


Now, when I look at the provided data file and read a record they've padded fields with spaces (ASCII code 32) - not nulls as they have described!

Has anyone else encountered this? If so, what approach have you taken?

Thanks,

Chris


 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Chris!

Has anyone else encountered this? If so, what approach have you taken?



Yup. And here's what I did: I kept the database format, that is, I didn't use null terminators, I used empty spaces to fill the remaining positions of each field value. For instance, if a field length in the database is 64 positions, and the provided value has 50 characters, then it will be saved with the 50 characters + (64 - 50) empty spaces.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chris,

I did the same thing as Roberto.
And you could/should of course add something about this decision in your choices.txt

Kind regards,
Roel
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also use spaces instead of null terminators.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic