r89028 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89027‎ | r89028 | r89029 >
Date:09:03, 28 May 2011
Author:hashar
Status:reverted
Tags:
Comment:
* Fix db->makeList() spacing
* Tests assertions where upside-down (expected <-> value)
* Tests did not use LIST_AND

Follow up r87992
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php
@@ -92,30 +92,30 @@
9393
9494 function testMakeNotInList() {
9595 $this->assertEquals(
 96+ "field IN ('0','1')",
9697 $this->db->makeList( array(
9798 'field' => array( 0, 1 )
98 - ) ),
99 - "field IN ('0','1')"
 99+ ), LIST_AND )
100100 );
101101 $this->assertEquals(
 102+ "field NOT IN ('0','1')",
102103 $this->db->makeList( array(
103104 'field!' => array( 0, 1 )
104 - ) ),
105 - "field NOT IN ('0','1')"
 105+ ), LIST_AND )
106106 );
107107
108108 // make sure an array with only one value use = or !=
109109 $this->assertEquals(
 110+ "field = '777'",
110111 $this->db->makeList( array(
111112 'field' => array( 777 )
112 - ) ),
113 - "field = 777"
 113+ ), LIST_AND )
114114 );
115115 $this->assertEquals(
 116+ "field != '888'",
116117 $this->db->makeList( array(
117118 'field!' => array( 888 )
118 - ) ),
119 - "field != 888"
 119+ ), LIST_AND )
120120 );
121121 }
122122 }
Index: trunk/phase3/includes/db/Database.php
@@ -1484,7 +1484,7 @@
14851485 $list .= $field . $operator . $this->addQuotes( $value[0] );
14861486 } else {
14871487 $operator = $not ? ' NOT IN ' : ' IN ';
1488 - $list .= $field . $operator . " (" . $this->makeList( $value ) . ") ";
 1488+ $list .= $field . $operator . "(" . $this->makeList( $value ) . ")";
14891489 }
14901490 } elseif ( $value === null ) {
14911491 if ( $mode == LIST_AND || $mode == LIST_OR ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r96930Revert r87992 and followups r87998, r89028 (Support abstraction for 'NOT IN' ...demon00:19, 13 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87992Support abstraction for 'NOT IN' SQL structure...hashar15:39, 13 May 2011

Status & tagging log