Inner Joins

Posts   
 
    
smcculloch avatar
smcculloch
User
Posts: 7
Joined: 01-Oct-2003
# Posted on: 01-Oct-2003 08:59:52   

Frans,

I saw your post on the inner joins, so the current behaviour is only inner joins at the moment, is that correct?

My scenario,

I have a Forum Table with a LastPostUserID that can be null, which links to the User Table. I think this is a weak relation by your definition.

(the user to Forum would not be a weak relation because you could get all forums that the user is the last poster for, is that correct?)

So am I best to use a Typed View, or a Stored Proc to handle this situation at the moment? (I was going to use a typed list, but realised it was only inner joins)

-Thanks again for a great product

sunglasses

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Oct-2003 09:56:35   

smcculloch wrote:

Frans, I saw your post on the inner joins, so the current behaviour is only inner joins at the moment, is that correct?

Correct. This will be changed in the release for October 7th, so weak relations are supported simple_smile

My scenario, I have a Forum Table with a LastPostUserID that can be null, which links to the User Table. I think this is a weak relation by your definition.

When LastPostUserID can be null, yes that's a weak relation. However, just out of curiosity, when that field is NULL, what does that value stand for? When that field is NULL, there are no postings? Or that user is deleted? On this forum I have a user called Anonymous, which has user ID 0. When a user is deleted, all postings posted by that user are set to userid 0. Perhaps this is what you're doing too with the NULL value

(the user to Forum would not be a weak relation because you could get all forums that the user is the last poster for, is that correct?)

User - Forum is also weak, because a user doesn't have to post. simple_smile (thus when you want a list of users and all the forums they posted in, you use a left join automatically, otherwise you will not get the users who didn't post any messages. The entity at the PK side of a relationship has never a strong relation with the entity at the FK side of the relationship.

So am I best to use a Typed View, or a Stored Proc to handle this situation at the moment? (I was going to use a typed list, but realised it was only inner joins)

I'd go for a typed view for now. Stored procedures return plain datatables/sets, so they're not that great to work with and typed views have more flexibility, you can filter them simple_smile

Frans Bouma | Lead developer LLBLGen Pro
smcculloch avatar
smcculloch
User
Posts: 7
Joined: 01-Oct-2003
# Posted on: 01-Oct-2003 10:05:26   

Correct. This will be changed in the release for October 7th, so weak relations are supported simple_smile

Awesome sunglasses

When LastPostUserID can be null, yes that's a weak relation. However, just out of curiosity, when that field is NULL, what does that value stand for? When that field is NULL, there are no postings? Or that user is deleted? On this forum I have a user called Anonymous, which has user ID 0. When a user is deleted, all postings posted by that user are set to userid 0. Perhaps this is what you're doing too with the NULL value

Yes, almost, I also needed a case when a new forum is created. It does not have any posts and therefore doesn't have a LastUserPostID.

User - Forum is also weak, because a user doesn't have to post. simple_smile (thus when you want a list of users and all the forums they posted in, you use a left join automatically, otherwise you will not get the users who didn't post any messages. The entity at the PK side of a relationship has never a strong relation with the entity at the FK side of the relationship.

Right, I understand now, flushed

I'd go for a typed view for now. Stored procedures return plain datatables/sets, so they're not that great to work with and typed views have more flexibility, you can filter them simple_smile

Great, thats what I was doing in the existing system. I was actually caching the forums since they did not change very often, and invalidating the cache on an insert/update. I would use a dataview to do the relevant filtering.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Oct-2003 10:23:53   

This functionality is now available (in the October 7th update). simple_smile

Frans Bouma | Lead developer LLBLGen Pro