Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | protected $supportedDBs = array( |
24 | 24 | 'mysql', |
25 | 25 | 'sqlite', |
| 26 | + 'postgres', |
26 | 27 | 'oracle' |
27 | 28 | ); |
28 | 29 | |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -688,6 +688,24 @@ |
689 | 689 | return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName (LIKE $oldName INCLUDING DEFAULTS)", $fname ); |
690 | 690 | } |
691 | 691 | |
| 692 | + function listTables( $prefix = null, $fname = 'DatabasePostgres::listTables' ) { |
| 693 | + global $wgDBmwschema; |
| 694 | + $eschema = $this->addQuotes( $wgDBmwschema ); |
| 695 | + $result = $this->query( "SELECT tablename FROM pg_tables WHERE schemaname = $eschema", $fname ); |
| 696 | + |
| 697 | + $endArray = array(); |
| 698 | + |
| 699 | + foreach( $result as $table ) { |
| 700 | + $vars = get_object_vars($table); |
| 701 | + $table = array_pop( $vars ); |
| 702 | + if( !$prefix || strpos( $table, $prefix ) === 0 ) { |
| 703 | + $endArray[] = $table; |
| 704 | + } |
| 705 | + } |
| 706 | + |
| 707 | + return $endArray; |
| 708 | + } |
| 709 | + |
692 | 710 | function timestamp( $ts = 0 ) { |
693 | 711 | return wfTimestamp( TS_POSTGRES, $ts ); |
694 | 712 | } |