SubSonic-3.0 icon indicating copy to clipboard operation
SubSonic-3.0 copied to clipboard

Bug: It will always use Inner Join if you use the LeftInnerJoin<T>("from", "to") method.

Open terryso opened this issue 15 years ago • 3 comments

In SqlQuery.cs line 610:

private void CreateJoin<T>(string fromColumnName, string toColumnName, Join.JoinType type) { //see if we can find the table var toTable = _provider.FindOrCreateTable(typeof(T));

        //the assumption here is that the FromTable[0] is the table to join from
        if(FromTables.Count == 0)
            throw new InvalidOperationException("Can't join if there's no table to join to - make sure to use From() before InnerJoin");

        if(toTable == null)
            throw new InvalidOperationException("Can't find the table for this type. Try using the Column instead");

        var fromColumn = FromTables[0].GetColumn(fromColumnName);
        if(fromColumn == null)
            throw new InvalidOperationException("Don't know which column to join to - can't find column " + fromColumnName + " in table " + FromTables[0].Name);

        var toColumn = toTable.GetColumn(toColumnName);
        if(toColumn == null)
            throw new InvalidOperationException("Don't know which column to join to - can't find column " + toColumnName + " in table " + toTable.Name);

        CreateJoin(fromColumn, toColumn, Join.JoinType.Inner);
    }

It always use Join.JoinType.Inner...

terryso avatar Nov 02 '09 12:11 terryso

Need more details on the exact issue here. Will close in one week if none are forthcoming.

adam7 avatar Feb 26 '10 13:02 adam7

Is the problem what is a "left inner" join anyway? My googling says most people say there is no such thing, but it is possibly valid syntax in Oracle???, but not in SQL Server. This actually got me a couple of months ago, where I just tab auto-completed on "L" and the query died. Had to stare at the code for a while before I suddenly went "WTF is an Left Inner Join???"

MikeWalsh avatar Feb 27 '10 09:02 MikeWalsh

Yep, I think WTF is a left inner join is my thought here too. I can't work out whether this is just legacy or exists for some random SQL dialect. I'll leave this open and hope someone chips in ...

adam7 avatar Mar 06 '10 19:03 adam7