Question about CRUD models validating column list

#11
[eluser]tonanbarbarian[/eluser]
i used to do this in a library i built years ago but i no longer see the sense.
as a developer you know which fields should exist and which should not.
what results is an extra query being run on each page request to get the names of the fields in the table and validate.

If you really feel the need to have something like this to verify the fields to stop queries dying if extra fields are somehow submitted, you are better off just have a property of the model that is a array of the field names. This is basically static and you have to update it if the fields change, but running a query each time to get the field names when 99.9999% of the time they will never change is a waste of server resources

The only time I would consider using code like this again would be if i built a system that had custom fields that were able to be added and removed from the table, and even then I probably would look at other ways of structuring my data so I did not have to have custom fields added to my table.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.