Followup r73348, r70608: move 'infinity' stuff to DB classes

This commit is contained in:
Chad Horohoe 2011-01-05 13:43:13 +00:00
parent 958d82a003
commit b61756cdea
3 changed files with 21 additions and 15 deletions

View file

@ -849,25 +849,12 @@ class Block {
/**
* Get a value to insert into expiry field of the database when infinite expiry
* is desired. In principle this could be DBMS-dependant, but currently all
* supported DBMS's support the string "infinity", so we just use that.
* is desired
*
* @return String
*/
public static function infinity() {
# This is a special keyword for timestamps in PostgreSQL, and
# works with CHAR(14) as well because "i" sorts after all numbers.
# BEGIN DatabaseMssql hack
# Since MSSQL doesn't recognize the infinity keyword, set date manually.
# TO-DO: Refactor for better DB portability and remove magic date
$dbr = wfGetDB( DB_SLAVE );
if ( $dbr->getType() == 'mssql' ) {
return '3000-01-31 00:00:00.000';
}
# End DatabaseMssql hack
return 'infinity';
return wfGetDB( DB_SLAVE )->getInfinity();
}
/**

View file

@ -2663,6 +2663,17 @@ abstract class DatabaseBase implements DatabaseType {
return 'SearchEngineDummy';
}
/**
* Find out when 'infinity' is. Most DBMSes support this. This is a special
* keyword for timestamps in PostgreSQL, and works with CHAR(14) as well
* because "i" sorts after all numbers.
*
* @return String
*/
public function getInfinity() {
return 'infinity';
}
/**
* Allow or deny "big selects" for this session only. This is done by setting
* the sql_big_selects session variable.

View file

@ -1040,6 +1040,14 @@ class DatabaseMssql extends DatabaseBase {
return "SearchMssql";
}
/**
* Since MSSQL doesn't recognize the infinity keyword, set date manually.
* @todo Remove magic date
*/
public function getInfinity() {
return '3000-01-31 00:00:00.000';
}
} // end DatabaseMssql class
/**