Welcome Guest, Not a member yet? Register   Sign In
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.


Messages In This Thread
Question about CRUD models validating column list - by El Forum - 11-16-2010, 10:50 AM
Question about CRUD models validating column list - by El Forum - 11-16-2010, 10:23 PM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 02:40 AM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 09:14 AM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 11:23 AM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 11:39 AM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 06:55 PM
Question about CRUD models validating column list - by El Forum - 11-17-2010, 08:46 PM
Question about CRUD models validating column list - by El Forum - 11-18-2010, 04:25 AM
Question about CRUD models validating column list - by El Forum - 11-18-2010, 09:20 PM
Question about CRUD models validating column list - by El Forum - 11-18-2010, 10:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB