Skip to content

New virtual method QuerySqlGenerator.GenerateSelect #25900

@dmitry-lipetsk

Description

@dmitry-lipetsk

Firebird DBMS (v3) has some limitation for arguments of "OFFSET" and "FETCH" in "SELECT" statement - it does not support expressions like "CAST(@param AS INTEGER)"

But it (Firebird) has alternative syntax:

SELECT
[FIRST m] [SKIP n]
[DISTINCT | ALL] ...

without these limitations.

I not see in current EFCore an any legal way for generation of SQL with FIRST and SKIP:

_relationalCommandBuilder.Append("SELECT ");
if (selectExpression.IsDistinct)
{
_relationalCommandBuilder.Append("DISTINCT ");
}
GenerateTop(selectExpression);

Could you move line with

_relationalCommandBuilder.Append("SELECT "); 

into separated new virtual function GenerateSelect?

I will override this function and append the generation of FIRST, SKIP.


Firebird DBMS supports an additional variant for this task - ROWS. Native Firebird provider for EFCore uses this statement in their code.

But usage of "ROWS" requires additional "+1" and uses long.MaxValue for describing unlimited number, so it looks less preferred than "FIRST/SKIP".


Of course, I may copy the body of QuerySqlGenerator.VisitSelect into my code (this is my current variant) and resolve this problem, but may be new method "GenerateSelect" will be usefully into another tasks.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions