http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70165

Revision: 70165
Author:   maxsem
Date:     2010-07-29 19:02:30 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
CodeReview: SQLite compatibility++. Now it builds LIKE queries using nice, 
portable and safe buildLike()

Modified Paths:
--------------
    trunk/extensions/CodeReview/backend/CodeRevision.php
    trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
    trunk/extensions/CodeReview/ui/CodeRevisionListView.php

Modified: trunk/extensions/CodeReview/backend/CodeRevision.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRevision.php        2010-07-29 
18:47:58 UTC (rev 70164)
+++ trunk/extensions/CodeReview/backend/CodeRevision.php        2010-07-29 
19:02:30 UTC (rev 70165)
@@ -689,7 +689,7 @@
                $dbr = wfGetDB( DB_SLAVE );
                return array(
                        'cp_repo_id' => $this->mRepoId,
-                       'cp_path LIKE ' . $dbr->addQuotes( $dbr->escapeLike( 
$path ) . '%' ),
+                       'cp_path ' . $dbr->buildLike( $path, $dbr->anyString() 
),
                        // performance
                        'cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 
20000 ),
                        // join conds

Modified: trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeReleaseNotes.php 2010-07-29 18:47:58 UTC 
(rev 70164)
+++ trunk/extensions/CodeReview/ui/CodeReleaseNotes.php 2010-07-29 19:02:30 UTC 
(rev 70165)
@@ -66,7 +66,7 @@
                        $where = 'cr_id >= ' . intval( $this->mStartRev );
                }
                if ( $this->mPath ) {
-                       $where .= ' AND (cr_path LIKE ' . $dbr->addQuotes( 
$dbr->escapeLike( "{$this->mPath}/" ) . '%' );
+                       $where .= ' AND (cr_path ' . $dbr->buildLike( 
"{$this->mPath}/", $dbr->anyString() );
                        $where .= ' OR cr_path = ' . $dbr->addQuotes( 
$this->mPath ) . ')';
                }
                # Select commits within this range...

Modified: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2010-07-29 
18:47:58 UTC (rev 70164)
+++ trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2010-07-29 
19:02:30 UTC (rev 70165)
@@ -235,7 +235,7 @@
                                'fields' => $this->getSelectFields(),
                                'conds' => array(
                                        'cp_repo_id' => $this->mRepo->getId(),
-                                       'cp_path LIKE ' . 
$this->mDb->addQuotes( $this->mDb->escapeLike( $this->getSVNPath() ) . '%' ),
+                                       'cp_path ' . $this->mDb->buildLike( 
$this->getSVNPath(), $this->mDb->anyString() ),
                                        // performance
                                        'cp_rev_id > ' . ( 
$this->mRepo->getLastStoredRev() - 20000 )
                                ),



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to