You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Alex Parvulescu (JIRA)" <ji...@apache.org> on 2011/04/11 18:39:06 UTC

[jira] [Created] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
----------------------------------------------------------------------------------------------------

                 Key: JCR-2939
                 URL: https://issues.apache.org/jira/browse/JCR-2939
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
            Reporter: Alex Parvulescu
            Priority: Minor


This is the original issue:
----------
I tried to get the childnodes of a node names "/a b" using the following code
  QueryManager queryManager=session.getWorkspace().getQueryManager();
  QueryObjectModelFactory qomf=queryManager.getQOMFactory();
  Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
  Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
  Constraint constraint2 = qomf.childNode("selector_0", "/a b");
  QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);

This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 

The sql statement getting created is 
SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
[/a b]).

When using webdav If i give this SQL2 query directly along with quotes around 
the path i.e. ['/a b'] then it is working as expected.
----------

this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 

This can be seen easily if we do a System.out.println(qom.getStatement())




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

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

Alex Parvulescu resolved JCR-2939.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.6
         Assignee: Alex Parvulescu

Merged to 2.2 in rev 1126557.

> QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2939
>                 URL: https://issues.apache.org/jira/browse/JCR-2939
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>            Priority: Minor
>             Fix For: 2.2.6
>
>         Attachments: JCR-2939.patch
>
>
> This is the original issue:
> ----------
> I tried to get the childnodes of a node names "/a b" using the following code
>   QueryManager queryManager=session.getWorkspace().getQueryManager();
>   QueryObjectModelFactory qomf=queryManager.getQOMFactory();
>   Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
>   Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
>   Constraint constraint2 = qomf.childNode("selector_0", "/a b");
>   QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);
> This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 
> The sql statement getting created is 
> SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
> [/a b]).
> When using webdav If i give this SQL2 query directly along with quotes around 
> the path i.e. ['/a b'] then it is working as expected.
> ----------
> this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
> this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 
> This can be seen easily if we do a System.out.println(qom.getStatement())

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

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

Alex Parvulescu updated JCR-2939:
---------------------------------

    Attachment: JCR-2939.patch

attached patch to fix and some tests

> QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2939
>                 URL: https://issues.apache.org/jira/browse/JCR-2939
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Alex Parvulescu
>            Priority: Minor
>         Attachments: JCR-2939.patch
>
>
> This is the original issue:
> ----------
> I tried to get the childnodes of a node names "/a b" using the following code
>   QueryManager queryManager=session.getWorkspace().getQueryManager();
>   QueryObjectModelFactory qomf=queryManager.getQOMFactory();
>   Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
>   Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
>   Constraint constraint2 = qomf.childNode("selector_0", "/a b");
>   QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);
> This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 
> The sql statement getting created is 
> SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
> [/a b]).
> When using webdav If i give this SQL2 query directly along with quotes around 
> the path i.e. ['/a b'] then it is working as expected.
> ----------
> this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
> this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 
> This can be seen easily if we do a System.out.println(qom.getStatement())

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

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

Marcel Reutegger updated JCR-2939:
----------------------------------

    Fix Version/s: 2.3.0

> QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2939
>                 URL: https://issues.apache.org/jira/browse/JCR-2939
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>            Priority: Minor
>             Fix For: 2.2.7, 2.3.0
>
>         Attachments: JCR-2939.patch
>
>
> This is the original issue:
> ----------
> I tried to get the childnodes of a node names "/a b" using the following code
>   QueryManager queryManager=session.getWorkspace().getQueryManager();
>   QueryObjectModelFactory qomf=queryManager.getQOMFactory();
>   Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
>   Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
>   Constraint constraint2 = qomf.childNode("selector_0", "/a b");
>   QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);
> This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 
> The sql statement getting created is 
> SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
> [/a b]).
> When using webdav If i give this SQL2 query directly along with quotes around 
> the path i.e. ['/a b'] then it is working as expected.
> ----------
> this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
> this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 
> This can be seen easily if we do a System.out.println(qom.getStatement())

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

Posted by "Alex Parvulescu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038006#comment-13038006 ] 

Alex Parvulescu commented on JCR-2939:
--------------------------------------

Fixed in trunk in rev 1126550 and 1126551 

> QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2939
>                 URL: https://issues.apache.org/jira/browse/JCR-2939
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Alex Parvulescu
>            Priority: Minor
>         Attachments: JCR-2939.patch
>
>
> This is the original issue:
> ----------
> I tried to get the childnodes of a node names "/a b" using the following code
>   QueryManager queryManager=session.getWorkspace().getQueryManager();
>   QueryObjectModelFactory qomf=queryManager.getQOMFactory();
>   Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
>   Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
>   Constraint constraint2 = qomf.childNode("selector_0", "/a b");
>   QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);
> This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 
> The sql statement getting created is 
> SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
> [/a b]).
> When using webdav If i give this SQL2 query directly along with quotes around 
> the path i.e. ['/a b'] then it is working as expected.
> ----------
> this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
> this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 
> This can be seen easily if we do a System.out.println(qom.getStatement())

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2939) QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path

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

Jukka Zitting updated JCR-2939:
-------------------------------

    Issue Type: Bug  (was: Improvement)

> QueryObjectModel does not generate the corresponding SQL2 Query when dealing with spaces in the path
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2939
>                 URL: https://issues.apache.org/jira/browse/JCR-2939
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>            Priority: Minor
>             Fix For: 2.2.7
>
>         Attachments: JCR-2939.patch
>
>
> This is the original issue:
> ----------
> I tried to get the childnodes of a node names "/a b" using the following code
>   QueryManager queryManager=session.getWorkspace().getQueryManager();
>   QueryObjectModelFactory qomf=queryManager.getQOMFactory();
>   Source source1=qomf.selector(NodeType.NT_BASE, "selector_0");
>   Column[] columns = new Column[]{qomf.column("selector_0", null, null)};
>   Constraint constraint2 = qomf.childNode("selector_0", "/a b");
>   QueryObjectModel qom = qomf.createQuery(source1, constraint2 , null, columns);
> This is not giving any result when the session is acquired through webdav. But when connected using JNDI it is giving the child nodes. 
> The sql statement getting created is 
> SELECT selector_0.* FROM [nt:base] AS selector_0 WHERE ISCHILDNODE(selector_0, 
> [/a b]).
> When using webdav If i give this SQL2 query directly along with quotes around 
> the path i.e. ['/a b'] then it is working as expected.
> ----------
> this doesn't have anything to do with webdav. the problem is the QueryObjectModel generates an SQL2 query that is not 100% equivalent, it fails to escape paths that have spaces in them.
> this way, in the case of davex remoting, the jr client will use the statement generated instead, which is not escaped, and will fail to return the expected nodes. 
> This can be seen easily if we do a System.out.println(qom.getStatement())

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira