Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-16688

Content keyword fetch function is not Oracle compatible (patch)

    XMLWordPrintable

Details

    Description

      The following error could occur when using fetch( 'content', 'keyword' ) in conjunction with oracle:

      Error (1791): ORA-01791: Kein mit SELECT ausgewählter Ausdruck
      Failed query at offset 1893:
      SELECT DISTINCT ezcontentobject_tree.node_id, substr( ezkeyword.keyword, 1, 4 ) AS keyword
      FROM ezkeyword, ezkeyword_attribute_link,ezcontentobject_tree,ezcontentobject,ezcontentclass
      , ezcontentobject_attribute a0, ezcontentobject_name, ezcontentobject_attribute a1
      
      WHERE
      
      a0.contentobject_id = ezcontentobject.id AND
      a0.contentclassattribute_id = 771 AND
      a0.version = ezcontentobject_name.content_version AND
      ( bitand( a0.language_id, ezcontentobject.language_mask ) > 0 AND
      bitand( ezcontentobject.language_mask - bitand( ezcontentobject.language_mask, a0.language_id ), 1 )
      + bitand( ezcontentobject.language_mask - bitand( ezcontentobject.language_mask, a0.language_id ), 2 ) <
      bitand( a0.language_id, 1 )
      + bitand( a0.language_id, 2 ) )
      AND ezcontentobject.id = ezcontentobject_name.contentobject_id AND a1.version=ezcontentobject.current_version
      AND a1.contentobject_id=ezcontentobject.id AND
      ezkeyword.keyword LIKE 'Eins%'
      AND ezcontentobject_tree.is_invisible = 0
      
      
      
      AND ezcontentobject_tree.parent_node_id = '253549'
      AND ezcontentclass.version=0
      AND ezcontentobject.status=1
      AND ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id
      AND ezcontentobject_tree.contentobject_id = ezcontentobject.id
      AND ezcontentclass.id = ezcontentobject.contentclass_id
      AND a1.id=ezkeyword_attribute_link.objectattribute_id
      AND ezkeyword_attribute_link.keyword_id = ezkeyword.id ORDER BY a0.sort_key_int ASC
      
      Start of error:
      a0.sort_key_int ASC
      

      The reason for the query to fail is, that when using "ORDER BY a0.sort_key_int", "a0.sort_key_int" must be in the list of SELECTed columns which is not the case.

      The attached patch fixes this by setting and using the already existing $sortingInfo['attributeTargetSQL'] variable correctly.

      Steps to reproduce
      • Use Oracle database
      • Execute:
        $result = eZContentFunctionCollection::fetchKeyword( $alphabet,
            $classid,
            $offset,
            $limit,
            $owner,
            $sortBy,
            $parentNodeID,
            $includeDuplicates,
            $strictMatching );
        

        where $sortBy is for example:

        array( 'attribute', true, 'keyword_test_class/keywords_attribute' );
        

      Attachments

        Activity

          People

            gl gl
            gl gl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: