Bug 51404

Summary: : Libreoffice Base with Oracle - SYSDATE, ROWNUM don't work in query!
Product: LibreOffice Reporter: MichaelB <mrbou>
Component: DatabaseAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: bz-freedesktop, dr, iplaw67, LibreOffice, lionel, mrbou, robert
Version: 3.5.4 release   
Hardware: Other   
OS: All   
See Also: https://issues.apache.org/ooo/show_bug.cgi?id=108593
Whiteboard: BSA
i915 platform: i915 features:

Description MichaelB 2012-06-25 04:54:15 UTC
Problem description: 
--------------------
Cannot execute some query (with sysdate, rownum) when used with Oracle database. 

There is already a bug from 2010 that refer to this problem may be (READ IT):
https://issues.apache.org/ooo/show_bug.cgi?id=108593


Steps to reproduce:
--------------------

- Add the library ojdbc6.jar

- Run query in Base 
 
- When i want retrieve the system date: SELECT TO_CHAR(sysdate, 'YYYY') FROM DUAL;

    Statut SQL: 42000 Code d'erreur: 904 / ORA-00904: "sysdate" : identificateur non valide

Or if i use "ROWNUM" to limit result in query.

    Statut SQL: 42000 Code d'erreur: 904 / ORA-00904: ROWNUM : identificateur non valide

All that query works if direcly executed in sqlplus tool from Oracle.


Current behavior:
--------------------
I got a error code, see above..

Expected behavior:
--------------------
To return the result..

Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Comment 1 Jochen 2012-08-29 18:47:48 UTC
@Rainer

this bugreport is confirmes on https://issues.apache.org/ooo/show_bug.cgi?id=108593
What shall we do: status changing to "NEW"?
Comment 2 Alex Thurgood 2012-12-28 13:59:37 UTC
*** Bug 58796 has been marked as a duplicate of this bug. ***
Comment 3 Alex Thurgood 2012-12-28 17:21:51 UTC
Confirming, this appears to be inherited from the OOo code, so it has probably always been present in our versions, even from LO 3.3.x.


Alex.
Comment 4 MichaelB 2013-01-12 10:19:44 UTC
Is someone can work on it or tell me where the parser file is (BUG: 108593) in the source code of Libre Office ? I really need this enhancement.
Comment 5 Rainer Bielefeld Retired 2013-01-12 11:12:12 UTC
@Lionel:
Can you help here?
Comment 6 Lionel Elie Mamane 2013-01-14 09:53:14 UTC
(In reply to comment #4)
> Is someone can work (...) tell me where the parser file is
> in the source code of Libre Office ?

The lexer/parser is in connectivity/source/parse, files sqlflex.l and sqlbison.y

I'll gladly review and apply your patch. Thanks in advance!

After making the parser able to dynamically add new keywords, we would have to initialise the list of accepted keywords.

When connecting through an ODBC driver we should initialise with:

 SQLGetInfo(,SQL_KEYWORDS,,,)

AND the value of SQL_ODBC_KEYWORDS (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms711681(v=vs.85).aspx )
 
I presume JDBC has a similar API call to get the datasource-specific keywords.


If we can design a more generic solution that would not require LibO to know the database's keywords, that would be double plus extra good. I don't have an idea out of the top of my head right now.
Comment 7 MichaelB 2013-05-17 07:39:16 UTC
I really would like help you and community but im not C++ developer. I analysed the code but is too complex for me. So if someone can work on this enhancement.. ;-)
Comment 8 Alex Thurgood 2015-01-03 17:39:07 UTC
Adding self to CC if not already on

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.