[ 
https://issues.apache.org/jira/browse/OFBIZ-5146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13929850#comment-13929850
 ] 

Paul Foxworthy commented on OFBIZ-5146:
---------------------------------------

I still lean towards favouring standards-based functions that are useful to us, 
such as EXTRACT(). Over time, it is likely that more DBMSes will directly 
support those functions, minimizing our effort. What's more, it should be easy 
to find examples to implement a standards-based function in a DBMS where the 
function is not currently supported. 

MONTH() and YEAR() are not like that. Every time we support any function like 
these, we need to think carefully about if and how that function might be 
implemented in every DBMS we think is important. If core OFBiz code is going to 
produce a "function missing" error, we need to know ahead of time. I would 
argue that there is a core set of DBMSes where we must have an implementation 
before we could make use of the function at all. Maybe that set is just 
Postgres, MySQL and MariaDB.

As it happens, both MySQL and Postgres already support EXTRACT(). If we are 
willing to stop there and say, "if your DBMS doesn't support EXTRACT(), you 
need to write a UDF to recreate that functionality", it ought to be simple to 
add EXTRACT().

MONTH() and YEAR() should be simple to implement in terms of EXTRACT(), so it's 
no big deal. All I'm saying is the next time another non-standard function is 
proposed, we make the same assessment.

There should be unit tests for any database function, so anyone wanting OFBiz 
to run on a DBMS of their choice can run the tests and discover the complete 
list of functions they would need to get working on their particular DBMS.

> in ModelViewEntity.java, a Map is built with only a few of the SQL functions, 
> extend the map to include the MONTH and Year functions.
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5146
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5146
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Jaideep Singh
>             Fix For: SVN trunk
>
>         Attachments: ModelViewEntity.patch, ModelViewEntity.patch
>
>
> in ModelViewEntity.java, a Map is built with only a few of the SQL functions, 
> extend the map to include the MONTH and Year functions.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to