Merge "Detect when callers catch DB errors and fail to rollback"
[lhc/web/wiklou.git] / includes / search / SearchMssql.php
index ed76ff8..5e8fb04 100644 (file)
@@ -34,7 +34,7 @@ class SearchMssql extends SearchDatabase {
         * @access public
         */
        function searchText( $term ) {
-               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
+               $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), true ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
 
@@ -46,7 +46,7 @@ class SearchMssql extends SearchDatabase {
         * @access public
         */
        function searchTitle( $term ) {
-               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
+               $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), false ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
 
@@ -79,6 +79,8 @@ class SearchMssql extends SearchDatabase {
         * Does not do anything for generic search engine
         * subclasses may define this though
         *
+        * @param string $filteredTerm
+        * @param bool $fulltext
         * @return string
         */
        function queryRanking( $filteredTerm, $fulltext ) {
@@ -128,16 +130,18 @@ class SearchMssql extends SearchDatabase {
        }
 
        /** @todo document
+        * @param string $filteredText
+        * @param bool $fulltext
         * @return string
         */
        function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
                $lc = $this->legalSearchChars();
-               $this->searchTerms = array();
+               $this->searchTerms = [];
 
                # @todo FIXME: This doesn't handle parenthetical expressions.
-               $m = array();
-               $q = array();
+               $m = [];
+               $q = [];
 
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                        $filteredText, $m, PREG_SET_ORDER ) ) {
@@ -156,9 +160,9 @@ class SearchMssql extends SearchDatabase {
                        }
                }
 
-               $searchon = $this->db->strencode( join( ',', $q ) );
+               $searchon = $this->db->addQuotes( implode( ',', $q ) );
                $field = $this->getIndexField( $fulltext );
-               return "$field, '$searchon'";
+               return "$field, $searchon";
        }
 
        /**