Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2512

Support for custom functions in Expression API and Property API

    XMLWordPrintableJSON

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.M1
    • Component/s: Core Library
    • Labels:
      None

      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

      <T> function(String functionName, Class<T> resultType, Object... arguments) {
         // ...
      }
      

      For the Expressions API we can use syntax like this:

      Expression exp = exp("fn('SQL_FUNCTION', db:some.path, 123)")
      

      This will cover almost all use cases with the exception of SQL functions with special syntax, like

      OVERLAY ( 'foo bar' PLACING 'baz' FROM 5 )
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ntimofeev Nikita Timofeev
                Reporter:
                ntimofeev Nikita Timofeev
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: