You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Dick (JIRA)" <ji...@apache.org> on 2008/02/06 06:13:08 UTC

[jira] Created: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Unable to execute native queries which start with the WITH keyword. 
--------------------------------------------------------------------

                 Key: OPENJPA-511
                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 1.0.1
         Environment: DB2
            Reporter: Michael Dick
            Assignee: Michael Dick
             Fix For: 1.1.0


Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.

Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 

I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 

The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566649#action_12566649 ] 

Patrick Linskey commented on OPENJPA-511:
-----------------------------------------

I would suggest putting a List<String> into DBDictionary that contains native SQL start words, and then putting WITH into the list in the DB2Dictionary constructor, and then change the logic to delegate to a new DBDictionary method to determine if a string is a SELECT-style statement or a callable statement.

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-511:
---------------------------------

    Attachment: OPENJPA-511.patch.txt

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-511:
---------------------------------

    Attachment:     (was: OPENJPA-511.patch.txt)

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566657#action_12566657 ] 

Michael Dick commented on OPENJPA-511:
--------------------------------------

That's pretty much what the patch does, I used a Set instead of a List, and I didn't mess with the callable statement checking though. I'm running the tests on 1.0.x now and I'll commit when they're done. 


> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-511:
---------------------------------

    Fix Version/s: 1.0.2

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.0.2, 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick closed OPENJPA-511.
--------------------------------

    Resolution: Fixed

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-511
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-511
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.0.2, 1.1.0
>
>         Attachments: OPENJPA-511.patch.txt
>
>
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive) and throws an exception if an application calls getSingleResult() or getResultList() if select isn't found.  As I understand it the WITH statement may only be used in conjunction with a SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply to other databases too. Additional documentation can be found in the DB2 infocenter : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.datatools.sqlbuilder.doc/topics/ruisqlbldrwth.html. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.