• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My acrobatics for data integrity.

 
Anton Golovin
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys! Again I trouble the forum with some tid bit of locking information. I implemented the find method in the Data class, but the business method, findRoom, could not guarantee that in a multi-threading environment, the records returned would be accurate. So the solution? Check the record for fulfilling the criteria twice! I am not kidding, alas, I am checking it twice, and the code is almost the same. The first time my find method checks it, and the second, my findRoom method checks it. What do you guys think? Is it somehow extra work, did I go into unnecessary complexity here, or is it right?

(Or maybe it could be the elegant solution, and the second, business-code check could at the same time fulfill the requirement of sending only complete matches to the client???)

Thanks for everyone's opinion!
[ September 14, 2004: Message edited by: Anton Golovin ]
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anton Golovin:
Hi, guys! Again I trouble the forum with some tid bit of locking information. I implemented the find method in the Data class, but the business method, findRoom, could not guarantee that in a multi-threading environment, the records returned would be accurate. So the solution? Check the record for fulfilling the criteria twice! I am not kidding, alas, I am checking it twice, and the code is almost the same. The first time my find method checks it, and the second, my findRoom method checks it. What do you guys think? Is it somehow extra work, did I go into unnecessary complexity here, or is it right?

(Or maybe it could be the elegant solution, and the second, business-code check could at the same time fulfill the requirement of sending only complete matches to the client???)

Thanks for everyone's opinion!

[ September 14, 2004: Message edited by: Anton Golovin ]


The database and business rules for find are different, so you probably do need to do a second filtering. There is a trick to provide the exact match, append a '\0' to the end of the search text, it will only match exactly. You also might need to process the OR condition and you need to check that the data hasn't been changed or deleted between your search and your retrieve. you also might want to sort the result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic