r79644 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79643‎ | r79644 | r79645 >
Date:13:43, 5 January 2011
Author:demon
Status:ok
Tags:
Comment:
Followup r73348, r70608: move 'infinity' stuff to DB classes
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Block.php
@@ -849,25 +849,12 @@
850850
851851 /**
852852 * Get a value to insert into expiry field of the database when infinite expiry
853 - * is desired. In principle this could be DBMS-dependant, but currently all
854 - * supported DBMS's support the string "infinity", so we just use that.
 853+ * is desired
855854 *
856855 * @return String
857856 */
858857 public static function infinity() {
859 - # This is a special keyword for timestamps in PostgreSQL, and
860 - # works with CHAR(14) as well because "i" sorts after all numbers.
861 -
862 - # BEGIN DatabaseMssql hack
863 - # Since MSSQL doesn't recognize the infinity keyword, set date manually.
864 - # TO-DO: Refactor for better DB portability and remove magic date
865 - $dbr = wfGetDB( DB_SLAVE );
866 - if ( $dbr->getType() == 'mssql' ) {
867 - return '3000-01-31 00:00:00.000';
868 - }
869 - # End DatabaseMssql hack
870 -
871 - return 'infinity';
 858+ return wfGetDB( DB_SLAVE )->getInfinity();
872859 }
873860
874861 /**
Index: trunk/phase3/includes/db/Database.php
@@ -2664,6 +2664,17 @@
26652665 }
26662666
26672667 /**
 2668+ * Find out when 'infinity' is. Most DBMSes support this. This is a special
 2669+ * keyword for timestamps in PostgreSQL, and works with CHAR(14) as well
 2670+ * because "i" sorts after all numbers.
 2671+ *
 2672+ * @return String
 2673+ */
 2674+ public function getInfinity() {
 2675+ return 'infinity';
 2676+ }
 2677+
 2678+ /**
26682679 * Allow or deny "big selects" for this session only. This is done by setting
26692680 * the sql_big_selects session variable.
26702681 *
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -1040,6 +1040,14 @@
10411041 return "SearchMssql";
10421042 }
10431043
 1044+ /**
 1045+ * Since MSSQL doesn't recognize the infinity keyword, set date manually.
 1046+ * @todo Remove magic date
 1047+ */
 1048+ public function getInfinity() {
 1049+ return '3000-01-31 00:00:00.000';
 1050+ }
 1051+
10441052 } // end DatabaseMssql class
10451053
10461054 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70608DatabaseMssql class and related changesyaauie23:44, 6 August 2010
r73348Followup r70608, don't use master connection just for type check, and use get...demon23:25, 19 September 2010

Status & tagging log