Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php |
— | — | @@ -872,7 +872,7 @@ |
873 | 873 | global $wgDBname, $smwgIQSubcategoryInclusions; |
874 | 874 | |
875 | 875 | $tablename = 'cats' . SMWSQLStore::$m_tablenum++; |
876 | | - $db->query( 'CREATE TEMPORARY TABLE ' . $wgDBname . '.' . $tablename . |
| 876 | + $db->query( 'CREATE TEMPORARY TABLE ' . $tablename . |
877 | 877 | '( cat_name VARCHAR(255) NOT NULL ) |
878 | 878 | TYPE=MEMORY', 'SMW::getCategoryTable' ); |
879 | 879 | if (array_key_exists($catname, SMWSQLStore::$m_categorytables)) { // just copy known result |
— | — | @@ -888,28 +888,26 @@ |
889 | 889 | $db->query( 'CREATE TEMPORARY TABLE smw_rescats |
890 | 890 | ( cat_name VARCHAR(255) NOT NULL ) |
891 | 891 | TYPE=MEMORY', 'SMW::getCategoryTable' ); |
| 892 | + $tmpnew = 'smw_newcats'; |
| 893 | + $tmpres = 'smw_rescats'; |
892 | 894 | |
893 | 895 | $pagetable = $db->tableName('page'); |
894 | 896 | $cltable = $db->tableName('categorylinks'); |
895 | | - $db->insert($tablename, array('cat_name' => $catname), 'SMW::getCategoryTable'); |
896 | | - $db->insert('smw_newcats', array('cat_name' => $catname), 'SMW::getCategoryTable'); |
897 | | - $tmpnew='smw_newcats'; |
898 | | - $tmpres='smw_rescats'; |
| 897 | + $db->query("INSERT INTO $tablename (cat_name) VALUES ('$catname')", 'SMW::getCategoryTable'); |
| 898 | + $db->query("INSERT INTO smw_newcats (cat_name) VALUES ('$catname')", 'SMW::getCategoryTable'); |
899 | 899 | |
900 | 900 | /// TODO: avoid duplicate results? |
901 | 901 | for ($i=0; $i<$smwgIQSubcategoryInclusions; $i++) { |
902 | | - $db->insertSelect($tmpres, |
903 | | - array($cltable,$pagetable,$tmpnew), |
904 | | - array('cat_name' => 'page_title'), |
905 | | - array( |
906 | | - "$cltable.cl_to=$tmpnew.cat_name AND |
907 | | - $pagetable.page_namespace=" . NS_CATEGORY . " AND |
908 | | - $pagetable.page_id=$cltable.cl_from"), 'SMW::getCategoryTable'); |
| 902 | + $db->query("INSERT INTO $tmpres (cat_name) SELECT $pagetable.page_title |
| 903 | + FROM $cltable,$pagetable,$tmpnew WHERE |
| 904 | + $cltable.cl_to=$tmpnew.cat_name AND |
| 905 | + $pagetable.page_namespace=" . NS_CATEGORY . " AND |
| 906 | + $pagetable.page_id=$cltable.cl_from", 'SMW::getCategoryTable'); |
909 | 907 | if ($db->affectedRows() == 0) { // no change, exit loop |
910 | 908 | continue; |
911 | 909 | } |
912 | | - $db->insertSelect($tablename, array($tmpres), array('cat_name' => 'cat_name'), |
913 | | - '*', 'SMW::getCategoryTable'); |
| 910 | + $db->query("INSERT INTO $tablename (cat_name) SELECT $tmpres.cat_name |
| 911 | + FROM $tmpres", 'SMW::getCategoryTable'); |
914 | 912 | $db->query('TRUNCATE TABLE ' . $tmpnew, 'SMW::getCategoryTable'); // empty "new" table |
915 | 913 | $tmpname = $tmpnew; |
916 | 914 | $tmpnew = $tmpres; |