You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (JIRA)" <ji...@apache.org> on 2019/01/17 14:13:00 UTC

[jira] [Updated] (CAY-2512) Support for custom functions in Expression API and Property API

     [ https://issues.apache.org/jira/browse/CAY-2512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikita Timofeev updated CAY-2512:
---------------------------------
    Description: 
Cayenne supports SQL functions since 4.0 but only a limited set common for all supported DBs.
There are a lot more SQL functions provided by each DB that can't be supported by Cayenne directly. So we need a way to allow calls to this functions for users.

For the Property API it can be implemented as  {code}
<T> function(String functionName, Class<T> resultType, Object... arguments) {
   // ...
}
{code}

For the Expressions API we can use syntax like this: {code}
Expression exp = exp("fn('SQL_FUNCTION', db:some.path, 123)")
{code}

This will cover almost all use cases with the exception of SQL functions with special syntax, like {code}
OVERLAY ( 'foo bar' PLACING 'baz' FROM 5 )
{code}


  was:
Cayenne supports SQL functions since 4.0 but only a limited set common for all supported DBs.
There are a lot more SQL functions provided by each DB that can't be supported by Cayenne directly. So we need a way to allow calls to this functions for users.

For the Property API it can be implemented as  {code}
<T> function(String functionName, Class<T> resultType, Object... arguments) {
   // ...
}
{code}

For the Expressions API we can use syntax like this: {code}
Expression exp = exp("function('SQL_FUNCTION', db:some.path, 123)")
{code}

This will cover almost all use cases with the exception of SQL functions with special syntax, like {code}
OVERLAY ( 'foo bar' PLACING 'baz' FROM 5 )
{code}



> Support for custom functions in Expression API and Property API
> ---------------------------------------------------------------
>
>                 Key: CAY-2512
>                 URL: https://issues.apache.org/jira/browse/CAY-2512
>             Project: Cayenne
>          Issue Type: Task
>          Components: Core Library
>            Reporter: Nikita Timofeev
>            Assignee: Nikita Timofeev
>            Priority: Major
>             Fix For: 4.2.M1
>
>
> Cayenne supports SQL functions since 4.0 but only a limited set common for all supported DBs.
> There are a lot more SQL functions provided by each DB that can't be supported by Cayenne directly. So we need a way to allow calls to this functions for users.
> For the Property API it can be implemented as  {code}
> <T> function(String functionName, Class<T> resultType, Object... arguments) {
>    // ...
> }
> {code}
> For the Expressions API we can use syntax like this: {code}
> Expression exp = exp("fn('SQL_FUNCTION', db:some.path, 123)")
> {code}
> This will cover almost all use cases with the exception of SQL functions with special syntax, like {code}
> OVERLAY ( 'foo bar' PLACING 'baz' FROM 5 )
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)