Fix generation of INTERVAL clause in the default case, fix method call
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 4 Nov 2010 18:25:38 +0000 (14:25 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 4 Nov 2010 18:26:18 +0000 (14:26 -0400)
framework/SQL/SQL.php
kronolith/migration/3_kronolith_upgrade_addallday.php

index d455aca..e272959 100644 (file)
@@ -187,7 +187,6 @@ class Horde_SQL {
     public function buildIntervalClause($dbh, $interval, $precision)
     {
         $type = $dbh instanceof Horde_Db_Adapter ? Horde_String::lower($dbh->adapterName()) : $dbh->phptype;
-        var_dump($type);
         switch ($type) {
         case 'pgsql':
         case 'pdo_postgresql':
@@ -197,7 +196,7 @@ class Horde_SQL {
             $clause = 'INTERVAL ' . $interval . '(' . $precision . ')';
             break;
         default:
-            $clause = 'INTERVAL ' . $interval . ' ' . $precision;
+            $clause = 'INTERVAL ' . $precision . ' ' . $interval;
         }
 
         return $clause;
index 446c868..95b0b58 100644 (file)
@@ -21,7 +21,7 @@ class KronolithUpgradeAddAllDay extends Horde_Db_Migration_Base
         $cols = $t->getColumns();
         if (!in_array('event_allday', array_keys($cols))) {
             $this->addColumn('kronolith_events', 'event_allday', 'integer', array('default' => 0));
-            $this->_connection->execute('UPDATE kronolith_events SET event_allday = 1 WHERE event_start + ' . Horde_SQL::buildIntervalClause($this->_connection, '1 DAY') . ' = event_end');
+            $this->_connection->execute('UPDATE kronolith_events SET event_allday = 1 WHERE event_start + ' . Horde_SQL::buildIntervalClause($this->_connection, 'DAY', 1) . ' = event_end');
         }
     }