Index: trunk/phase3/includes/db/DatabaseMysql.php |
— | — | @@ -7,6 +7,10 @@ |
8 | 8 | * @see Database |
9 | 9 | */ |
10 | 10 | class DatabaseMysql extends DatabaseBase { |
| 11 | + function getType() { |
| 12 | + return 'mysql'; |
| 13 | + } |
| 14 | + |
11 | 15 | /*private*/ function doQuery( $sql ) { |
12 | 16 | if( $this->bufferResults() ) { |
13 | 17 | $ret = mysql_query( $sql, $this->mConn ); |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -192,6 +192,10 @@ |
193 | 193 | wfRunHooks( 'DatabaseOraclePostInit', array( &$this ) ); |
194 | 194 | } |
195 | 195 | |
| 196 | + function getType() { |
| 197 | + return 'oracle'; |
| 198 | + } |
| 199 | + |
196 | 200 | function cascadingDeletes() { |
197 | 201 | return true; |
198 | 202 | } |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -84,6 +84,10 @@ |
85 | 85 | |
86 | 86 | } |
87 | 87 | |
| 88 | + function getType() { |
| 89 | + return 'postgres'; |
| 90 | + } |
| 91 | + |
88 | 92 | function cascadingDeletes() { |
89 | 93 | return true; |
90 | 94 | } |
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -391,8 +391,11 @@ |
392 | 392 | return $this->mDBname; |
393 | 393 | } |
394 | 394 | } |
| 395 | + |
| 396 | + function getType() { |
| 397 | + return 'ibm_db2'; |
| 398 | + } |
395 | 399 | |
396 | | - |
397 | 400 | ###################################### |
398 | 401 | # Setup |
399 | 402 | ###################################### |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -287,13 +287,7 @@ |
288 | 288 | /** |
289 | 289 | * Get the type of the DBMS, as it appears in $wgDBtype. |
290 | 290 | */ |
291 | | - function getType() { |
292 | | - if ( preg_match( '/^Database(\w+)$/', get_class( $this ), $m ) ) { |
293 | | - return strtolower( $m[1] ); |
294 | | - } else { |
295 | | - throw new MWException( get_class( $this ) .'::getType: unable to determine type.' ); |
296 | | - } |
297 | | - } |
| 291 | + abstract function getType(); |
298 | 292 | |
299 | 293 | #------------------------------------------------------------------------------ |
300 | 294 | # Other functions |
Index: trunk/phase3/includes/db/DatabaseMssql.php |
— | — | @@ -45,6 +45,10 @@ |
46 | 46 | |
47 | 47 | } |
48 | 48 | |
| 49 | + function getType() { |
| 50 | + return 'mssql'; |
| 51 | + } |
| 52 | + |
49 | 53 | /** |
50 | 54 | * todo: check if these should be true like parent class |
51 | 55 | */ |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -32,6 +32,10 @@ |
33 | 33 | $this->open( $server, $user, $password, $dbName ); |
34 | 34 | } |
35 | 35 | |
| 36 | + function getType() { |
| 37 | + return 'sqlite'; |
| 38 | + } |
| 39 | + |
36 | 40 | /** |
37 | 41 | * @todo: check if it should be true like parent class |
38 | 42 | */ |