Dear Marcio, I appreciate your concern and indeed we should consider this. In Oracle using TO_CHAR(someDateColumn, 'YYYY') can be used to extract the year from a date as a string but I must admit that one would probably expect the year function to return a number.
We could wrap this and perform a number conversion, but IMO using EXTRACT(YEAR FROM someDateColumn) would be a much better way of implementing this. However it has only been available since Oracle 9i. As far as your test proposal is concerned I don't think checking for the function name as you suggested does make any sense. How a particular SQL function is rendered to SQL is up to the driver and the implementation may change any time or even be different for different versions of a particular engine. Ideally you should write test that really extracts the year from a date stored in the database and check the result. This requires a complex test environment with all databases running and is probably not feasible - but the only way to know the truth. So since I am sure, that there are not many people using Oracle 8 or an earlier version any more, I will change the default implementation for the date extraction functions (day, month, year) to the Oracle extract function mentioned above. I may add a switch for Oracle 8 compatibility. Does anyone have concerns about this? Regards, Rainer Marcio Mazza wrote: > from: Marcio Mazza [mailto:[email protected]] > to: [email protected] > re: year "functionName" for Oracle > > I'm in doubt if the method > org.apache.empire.db.expr.column.DBFuncExpr.getFunctionName() > > will work fine with Oracle, for some date related functions. > > I think the method it is called just for generating XML. > Maybe a *test* for such feature should be done for the Oracle driver. > > I attach a sample test (for the year function) to make things clearer. > Oracle has a "strange" name for the year function. Is that correct?
