Jan 21, 2002, 10:38 AM
Veteran / Moderator (6956 posts)
Jan 21, 2002, 10:38 AM
Post #6 of 10
Views: 2247
I thought about using the LinkOwner field, and you could do that, but the problem was presented as
a) "limiting the number of link submissions per user to 1"
_not_
b) "allowing each userID to only have one link attached to it".
Semantically and logically, these are different problems, and would be evidenced down the road, if changes were made to the Link record, or other methods of tracking links, or if your needs change, such as wanting to allow multiple Links per [upgraded] user, or even a time between modify. What if the admin wants to assign links to users, that don't count as the users upload? What if the admin now wants to allow 2 links per user? What if a user can buy more upload credits??
The "concept" is that the User is allowed to add one link to the database. That is an attribute of the User and User-table, not the link record, or the relation between the two tables.
An existing link in the database shouldn't preclude a user from "adding" a link -- necessarily.
While it could be made to function in a similar fashion in this case, by looking at the LinkOwner field, it really hasn't attacked the problem, or solved the problem in a database-normal type fashion.
I might be picking nits, but with the ability of LinkSQL to grow into a huge "community", addressing the stated issue, or the "real" issue, rather than a quick fix is important. It's easy for the database to become unmanageable, and for relation assumptions to exist between tables that are not truly valid.
1) If you want to limit each Username to one link in the database, then you can use the LinkOwner field, since each Link has an owner, and you want a 1<=>1 relationship between them. In that case, the Link table is the "dominant" table, and if a record exists in it, you block addition of another. I don't see this as an extremely valid, or useful relationship. It's got very limited application, and is hard to scale properly.
2) If you want to limit the number of SUBMISSIONS from each user ID, that requires tracking of the userID, and the number of submissions it's made, and perhaps the date of submission. In this case the USER table is dominant, and the info should be based on that (or a relation table). If you only want one submission, you can use the date of last submission to track that -- no date, no submission. If you want to allow multiple submissions per user, you would want to keep track of the number of submissions, and date of last submission (perhaps even a more complicated relationship, but that would then require information as stored in the link). It would - theoretically - be possible to reconstruct the "submissions" from the LinkOwner field, but not necessarily -- since an editor or admin can muck that up by assigning a non-submitted item to that Username. Multiple Link records with the same Username can exist, but the User is still allowed _one_ submission of his own.
Again, I'm trying to explain a subtlety, but the problem as presented was "allowing each user to submit one and only one link" (and I added per-unit-time on my own <G>), not the deviant converse of allowing only one link per Username.
One is easily, and logically scaleable, the other isn't.
Your solution may work for now, as desired, as a quick fix, but I see a "gotcha" in it down the road if scalability is needed.
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.