Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -952,10 +952,19 @@ |
953 | 953 | $this->updateRedirects( $oldtitle->getDBkey(), $oldtitle->getNamespace(), $newtitle->getDBkey(), $newtitle->getNamespace() ); |
954 | 954 | |
955 | 955 | // Associate internal objects (subobjects) with the new title: |
956 | | - $db->update( 'smw_ids', |
957 | | - array( 'smw_title' => $newtitle->getDBkey(), 'smw_namespace' => $newtitle->getNamespace(), 'smw_iw' => '' ), |
958 | | - array( 'smw_title' => $oldtitle->getDBkey(), 'smw_namespace' => $oldtitle->getNamespace(), 'smw_iw' => '', 'smw_subobject!' => array( '' ) ), // array() needed for ! to work |
959 | | - __METHOD__ ); |
| 956 | + $table = $db->tableName( 'smw_ids' ); |
| 957 | + $values = array( 'smw_title' => $newtitle->getDBkey(), 'smw_namespace' => $newtitle->getNamespace(), 'smw_iw' => '' ); |
| 958 | + $sql = "UPDATE $table SET " . $db->makeList( $values, LIST_SET ) . |
| 959 | + ' WHERE smw_title = ' . $db->addQuotes( $oldtitle->getDBkey() ) . ' AND ' . |
| 960 | + 'smw_namespace = ' . $db->addQuotes( $oldtitle->getNamespace() ) . ' AND ' . |
| 961 | + 'smw_iw = ' . $db->addQuotes( '' ) . ' AND ' . |
| 962 | + 'smw_subobject != ' . $db->addQuotes( '' ); |
| 963 | + $db->query( $sql, __METHOD__ ); |
| 964 | +// The below code can be used instead when moving to MW 1.17 (support for '!' in Database::makeList()): |
| 965 | +// $db->update( 'smw_ids', |
| 966 | +// array( 'smw_title' => $newtitle->getDBkey(), 'smw_namespace' => $newtitle->getNamespace(), 'smw_iw' => '' ), |
| 967 | +// array( 'smw_title' => $oldtitle->getDBkey(), 'smw_namespace' => $oldtitle->getNamespace(), 'smw_iw' => '', 'smw_subobject!' => array( '' ) ), // array() needed for ! to work |
| 968 | +// __METHOD__ ); |
960 | 969 | } |
961 | 970 | |
962 | 971 | wfProfileOut( "SMWSQLStore2::changeTitle (SMW)" ); |
— | — | @@ -2249,10 +2258,15 @@ |
2250 | 2259 | |
2251 | 2260 | // also find subobjects used by this ID ... |
2252 | 2261 | $res = $db->select( 'smw_ids', 'smw_id', |
2253 | | - array( 'smw_title' => $subject->getDBkey(), |
2254 | | - 'smw_namespace' => $subject->getNamespace(), |
2255 | | - 'smw_iw' => $subject->getInterwiki(), |
2256 | | - 'smw_subobject!' => array( '' ) ), // ! (NOT) in MW only supported for array values! |
| 2262 | + 'smw_title = ' . $db->addQuotes( $subject->getDBkey() ) . ' AND ' . |
| 2263 | + 'smw_namespace = ' . $db->addQuotes( $subject->getNamespace() ) . ' AND ' . |
| 2264 | + 'smw_iw = ' . $db->addQuotes( $subject->getInterwiki() ) . ' AND ' . |
| 2265 | + 'smw_subobject != ' . $db->addQuotes( '' ), |
| 2266 | +// The below code can be used instead when moving to MW 1.17 (support for '!' in Database::makeList()): |
| 2267 | +// array( 'smw_title' => $subject->getDBkey(), |
| 2268 | +// 'smw_namespace' => $subject->getNamespace(), |
| 2269 | +// 'smw_iw' => $subject->getInterwiki(), |
| 2270 | +// 'smw_subobject!' => array( '' ) ), // ! (NOT) in MW only supported for array values! |
2257 | 2271 | __METHOD__ ); |
2258 | 2272 | $subobjects = array(); |
2259 | 2273 | |