Incorrect dwsLinqSql.LinqSqlFactory declaration

Issue #54 closed
Maksim Abramovich created an issue

"compiler: IdwsCompiler" is required (interface) but "compiler: TdwsCompiler" found (class)

I assume TdwsCompiler (class) type should be replaced with IdwsCompiler (interface) type all over the unit but below fix may work as well.

function LinqSqlFactory(compiler: IdwsCompiler; symbol: TTypeSymbol): ILinqQueryBuilder;
var
   factory: TLinqSqlFactory;
begin
   factory := TLinqSqlFactory.Create(compiler.Compiler);
   if symbol.IsCompatible(factory.FDatabaseSymbol) then
      result := factory
   else begin
      result := nil;
      factory.Free;
   end;
end;

Comments (2)

  1. DreddFoxx1

    I can confirm that this is working:

    -FCompiler: TdwsCompiler;
    +FCompiler: IdwsCompiler;
    
    -constructor Create(compiler: TdwsCompiler);
    +constructor Create(compiler: IdwsCompiler);
    
    -constructor TLinqSqlFactory.Create(compiler: TdwsCompiler);
    +constructor TLinqSqlFactory.Create(compiler: IdwsCompiler);
    
    procedure TLinqSqlFactory.Finalize(From: TTypedExpr);
    begin
    -TSqlFromExpr(from).Codegen(FCompiler);
    +TSqlFromExpr(from).Codegen(FCompiler.Compiler);
    end;
    
    
    -function LinqSqlFactory(compiler: TdwsCompiler; symbol: TTypeSymbol): ILinqQueryBuilder;
    +function LinqSqlFactory(compiler: IdwsCompiler; symbol: TTypeSymbol): ILinqQueryBuilder;
    
  2. Eric Grange repo owner
    • edited description
    • changed status to closed

    Linq units compile, but are not maintained at the moment beyond compilation

  3. Log in to comment