Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-258

DefaultProfileBasedRightsManager produces ORA-00933: SQL command not properly ended

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.0.0 M3
    • 1.1.8
    • Plugin core
    • None
    • Oracle 10

      The exception:

      java.sql.SQLException: ORA-00933: la commande SQL ne se termine pas correctement
      	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
      	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
      	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
      	at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:813)
      	at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
      	at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854)
      	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
      	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
      	at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.avalon.excalibur.datasource.AbstractJdbcConnection$ProxiedObject.invoke(AbstractJdbcConnection.java:468)
      	at $Proxy14.executeQuery(Unknown Source)
      	at org.ametys.runtime.plugins.core.right.profile.DefaultProfileBasedRightsManager.hasUserOnlyRight(DefaultProfileBasedRightsManager.java:1076)
      	at org.ametys.runtime.plugins.core.right.profile.DefaultProfileBasedRightsManager.hasRight(DefaultProfileBasedRightsManager.java:355)
             ...
      

      The SQL executed:

      SELECT UR.Context FROM Rights_ProfileRights AS PR, Rights_UserRights AS UR
      WHERE PR.Right_Id = ? AND UR.Profile_Id = PR.Profile_Id AND UR.Login = ? AND
       (UR.Context = ? OR UR.Context LIKE ? OR UR.Context = ? OR UR.Context = ? )
      

      This is because the token AS is not supported by Oracle for table references (but supported on column references) even if it is SQL-99 compliant!
      As this token is optional in SQL-99, i propose to remove it:

        <query specification>    ::=    SELECT  [ <set quantifier> ] <select list> <table expression>
        ...
        <table expression>    ::=   <from clause> [ <where clause> ] [ <group by clause> ] [ <having clause> ] 
        <from clause>    ::=    FROM  <table reference list>
        <table reference list>    ::=   <table reference> [ { <comma> <table reference> }... ]
        <table reference>    ::=   <table primary> | <joined table>
        <table primary>    ::=
               <table or query name> [ [ AS ] <correlation name> [ <left paren> <derived column list> <right paren> ] ]
           |     ...
      

            Unassigned Unassigned
            yabon Sébastien Launay (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: