Welcome Guest, Not a member yet? Register   Sign In
Model relationships
#9

[eluser]obiron2[/eluser]
That was kind of my point. Do you write a join query multiple times and return a flat dataset or run each query separately looping through the previous results set.

E.g.

I am writing a system that has the following as 1 to many relationships with unique id as a foreign key in the child table:-

Leagues, Seasons, Divisions, Games, Results.

If I need to validate whether a league administrator has the rights to modify a specific result I need to run back up the hierachy to see whether they have a record in the League_admins table. Is it more effient from a process design to get the game from the result, load the games model and get the division from the game etc. or simply write one query in the results model that joins the fields together unitl I get to the leagues. doing it the first way requires multiple DB calls but has maximum flexibility. Doing it the second way requires only one DB call but I would need to write (and rewrite) the output result for each level of the query and breaks the Object concept of a game should not care how it is related to a Division; it should just ask the divison model for the answer.

Obiron


Messages In This Thread
Model relationships - by El Forum - 01-13-2009, 06:24 PM
Model relationships - by El Forum - 01-13-2009, 10:52 PM
Model relationships - by El Forum - 01-13-2009, 11:06 PM
Model relationships - by El Forum - 01-14-2009, 02:44 AM
Model relationships - by El Forum - 01-14-2009, 04:30 AM
Model relationships - by El Forum - 01-14-2009, 05:36 AM
Model relationships - by El Forum - 01-14-2009, 06:11 AM
Model relationships - by El Forum - 01-14-2009, 06:31 AM
Model relationships - by El Forum - 01-14-2009, 08:23 AM
Model relationships - by El Forum - 01-15-2009, 12:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB