Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where should I put the SQL?

 
James Beeson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should my SQL to update my objects go in their class definitions or should I try to collect the SQL for my classes into libraries of SQL?
Where should I put the SQL???

------------------
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would place the SQL in its own class. This is just my opinion. It probably wouldn't make a difference where you put it but it would make it much easier to maintain if all SQL where contained in its own separate class.
Frank
 
Tom P
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with placing all the SQL for a project in one class is that you end up with 15 programmers all needing to make changes to the same class at the same time. It's better to put the SQL into a class that is going to do the creation of the entity object. You can have all the insert, update, delete, and select statements for a single entity in one place.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic