@@ -191,7 +191,7 @@ protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstant
191
191
base . VisitSqlConstant ( sqlConstantExpression ) ;
192
192
if ( shouldExplicitStringLiteralTypes )
193
193
{
194
- var isUnicode = FbTypeMappingSource . IsUnicode ( sqlConstantExpression . TypeMapping ) ;
194
+ var isUnicode = FbTypeMappingSource . IsUnicode ( sqlConstantExpression . TypeMapping ) ;
195
195
Sql . Append ( " AS " ) ;
196
196
Sql . Append ( ( ( IFbSqlGenerationHelper ) Dependencies . SqlGenerationHelper ) . StringLiteralQueryType ( sqlConstantExpression . Value as string , isUnicode ) ) ;
197
197
Sql . Append ( ")" ) ;
@@ -280,6 +280,60 @@ protected override void GenerateOrderings(SelectExpression selectExpression)
280
280
}
281
281
}
282
282
283
+ // Adapted from Npgsql Entity Framework Core provider
284
+ // (https://github.com/npgsql/efcore.pg)
285
+ // Copyright (c) 2002-2021, Npgsql
286
+ protected override Expression VisitCrossApply ( CrossApplyExpression crossApplyExpression )
287
+ {
288
+ Sql . Append ( "JOIN LATERAL " ) ;
289
+
290
+ if ( crossApplyExpression . Table is TableExpression table )
291
+ {
292
+ // Firebird doesn't support LATERAL JOIN over table, and it doesn't really make sense to do it - but EF Core
293
+ // will sometimes generate that.
294
+ Sql
295
+ . Append ( "(SELECT * FROM " )
296
+ . Append ( Dependencies . SqlGenerationHelper . DelimitIdentifier ( table . Name , table . Schema ) )
297
+ . Append ( ")" )
298
+ . Append ( AliasSeparator )
299
+ . Append ( Dependencies . SqlGenerationHelper . DelimitIdentifier ( table . Alias ) ) ;
300
+ }
301
+ else
302
+ {
303
+ Visit ( crossApplyExpression . Table ) ;
304
+ }
305
+
306
+ Sql . Append ( " ON TRUE" ) ;
307
+ return crossApplyExpression ;
308
+ }
309
+
310
+ // Adapted from Npgsql Entity Framework Core provider
311
+ // (https://github.com/npgsql/efcore.pg)
312
+ // Copyright (c) 2002-2021, Npgsql
313
+ protected override Expression VisitOuterApply ( OuterApplyExpression outerApplyExpression )
314
+ {
315
+ Sql . Append ( "LEFT JOIN LATERAL " ) ;
316
+
317
+ if ( outerApplyExpression . Table is TableExpression table )
318
+ {
319
+ // Firebird doesn't support LATERAL JOIN over table, and it doesn't really make sense to do it - but EF Core
320
+ // will sometimes generate that.
321
+ Sql
322
+ . Append ( "(SELECT * FROM " )
323
+ . Append ( Dependencies . SqlGenerationHelper . DelimitIdentifier ( table . Name , table . Schema ) )
324
+ . Append ( ")" )
325
+ . Append ( AliasSeparator )
326
+ . Append ( Dependencies . SqlGenerationHelper . DelimitIdentifier ( table . Alias ) ) ;
327
+ }
328
+ else
329
+ {
330
+ Visit ( outerApplyExpression . Table ) ;
331
+ }
332
+
333
+ Sql . Append ( " ON TRUE" ) ;
334
+ return outerApplyExpression ;
335
+ }
336
+
283
337
protected override void GeneratePseudoFromClause ( )
284
338
{
285
339
Sql . Append ( " FROM RDB$DATABASE" ) ;
0 commit comments