| 1 | <?php |
| 2 | /** |
| 3 | * DO NOT use it in production. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | * http://www.gnu.org/copyleft/gpl.html |
| 19 | * |
| 20 | * @file |
| 21 | */ |
| 22 | |
| 23 | namespace MediaWiki\Tests\Unit\Libs\Rdbms; |
| 24 | |
| 25 | use Wikimedia\Rdbms\Platform\SQLPlatform; |
| 26 | |
| 27 | class SQLPlatformTestHelper extends SQLPlatform { |
| 28 | /** |
| 29 | * @var bool Value to return from unionSupportsOrderAndLimit() |
| 30 | */ |
| 31 | protected $unionSupportsOrderAndLimit = true; |
| 32 | |
| 33 | /** |
| 34 | * TODO: remove |
| 35 | * |
| 36 | * This was previously a stub for an abstract method, but now this is the |
| 37 | * only override. But many tests depend on unquoted table names appearing |
| 38 | * in query strings. |
| 39 | * |
| 40 | * @param string $s |
| 41 | * @return string |
| 42 | */ |
| 43 | public function addIdentifierQuotes( $s ) { |
| 44 | return $s; |
| 45 | } |
| 46 | |
| 47 | public function useIndexClause( $index ) { |
| 48 | return "FORCE INDEX (" . $this->indexName( $index ) . ")"; |
| 49 | } |
| 50 | |
| 51 | public function ignoreIndexClause( $index ) { |
| 52 | return "IGNORE INDEX (" . $this->indexName( $index ) . ")"; |
| 53 | } |
| 54 | |
| 55 | public function unionSupportsOrderAndLimit() { |
| 56 | return $this->unionSupportsOrderAndLimit; |
| 57 | } |
| 58 | |
| 59 | public function setUnionSupportsOrderAndLimit( $v ) { |
| 60 | $this->unionSupportsOrderAndLimit = (bool)$v; |
| 61 | } |
| 62 | } |