Is your feature request related to a problem?
When calling scalar functions with fully qualified names (e.g., cross-database function calls in MSSQL like other_db.dbo.my_function(arg1, arg2)), there is no convenient API in SQLExpressions.
Currently, the only option is to manually construct template strings with positional placeholders:
Expressions.stringTemplate("other_db.dbo.my_function({0}, {1}, {2})", arg1, arg2, arg3);
RelationalFunctionCall exists but is designed for table-valued functions in FROM/JOIN clauses, not for scalar contexts (SELECT, WHERE, INSERT VALUES).
Describe the solution you'd like
Add scalar function call factory methods to SQLExpressions:
// Generic
SQLExpressions.function(String.class, "other_db.dbo.my_function", arg1, arg2);
// String-returning
SQLExpressions.stringFunction("other_db.dbo.my_function", arg1, arg2);
// Number-returning
SQLExpressions.numberFunction(Integer.class, "dbo.calculate", arg1);
The function name would be passed through as-is, supporting:
my_function(...) - simple
schema.my_function(...) - 2-part
database.schema.my_function(...) - 3-part (cross-database)
server.database.schema.my_function(...) - 4-part (linked server)
Additional context
I have an implementation ready and can submit a PR if this approach is acceptable.
Is your feature request related to a problem?
When calling scalar functions with fully qualified names (e.g., cross-database function calls in MSSQL like
other_db.dbo.my_function(arg1, arg2)), there is no convenient API inSQLExpressions.Currently, the only option is to manually construct template strings with positional placeholders:
RelationalFunctionCallexists but is designed for table-valued functions in FROM/JOIN clauses, not for scalar contexts (SELECT, WHERE, INSERT VALUES).Describe the solution you'd like
Add scalar function call factory methods to
SQLExpressions:The function name would be passed through as-is, supporting:
my_function(...)- simpleschema.my_function(...)- 2-partdatabase.schema.my_function(...)- 3-part (cross-database)server.database.schema.my_function(...)- 4-part (linked server)Additional context
I have an implementation ready and can submit a PR if this approach is acceptable.