Warning!

It seems that you are using an anti-advertisement software like AdBlock.
I like AdBlock too, but I configured it to block only invasive and annoying advertisement and popups.

CoolSoft can exists thanks to a few banners and no popups.
Please add this site it to your exclusion list, as shown in the following image.

Thanks for your help.

Reply to comment

Patch file for date_api_sql.inc

Hi Davyd, I had the same problem two months ago on my site. As Claudio already said, the Date module needs a lot of patches. In almost every function you have a switch ($db_type) { Here my patch file for date/date_api_sql.inc. It is by far not perfect, but it works for me, may be also for you.
--- date_api_sql.orig.inc	So Mai  3 17:37:16 2009
+++ date_api_sql.inc	Di Jul 14 20:58:37 2009
@@ -14,6 +14,7 @@
     case('mysqli'):
       return "CONCAT(". implode(",", $array) .")";
     case('pgsql'):
+    case('sqlite'):
       return implode(" || ", $array);
   }
 }
@@ -30,6 +31,7 @@
     case('mysql'):
     case('mysqli'):
     case('pgsql'):
+    case('sqlite'):
       return "COALESCE(". implode(',', $array) .")";
   }  
 }
@@ -97,7 +99,10 @@
           if ($test == '2008-02-15 06:00:00') {
             $has_support = TRUE;
           }
-        break;
+          break;
+        case('sqlite'):
+          // no support
+          break;
       }
       variable_set('date_db_tz_support', $has_support);
     }
@@ -130,6 +135,9 @@
       elseif ($type == 'pgsql') {
         db_query("SET TIME ZONE INTERVAL '$offset' HOUR TO MINUTE");
       }
+      elseif ($type == 'sqlite') {
+        // no support
+      }
       $already_set = true;
     }
   }
@@ -185,6 +193,18 @@
             break;
         }
         break;
+      case('sqlite'):
+        switch ($this->date_type) {
+          case DATE_UNIX:
+            $field = "FROM_UNIXTIME($field)";
+            break;
+          case DATE_ISO:
+            $field = "REPLACE($field, 'T', ' ')";
+            break;
+          case DATE_DATETIME:
+            break;
+        }
+        break;
       case 'pgsql':
         switch ($this->date_type) {
           case DATE_UNIX:
@@ -216,6 +236,17 @@
           else {
             return "DATE_ADD($field, INTERVAL $offset SECOND)";
           }
+        case('sqlite'):
+          $offset = ($offset >= 0) ? "+ $offset" : ("- " . -$offset);
+          switch ($this->date_type) {
+            case DATE_UNIX:
+              return "($field $offset)";
+            case DATE_ISO:
+              return "STRFTIME('%Y-%m-%%dT%H:%M:%S', $field, '$offset SECONDS')";
+            case DATE_DATETIME:
+              return "DATETIME($field, '$offset SECONDS')";
+          }
+          break;
         case 'pgsql':
           return "($field + INTERVAL '$offset SECONDS')";;
       }
@@ -247,6 +278,16 @@
           case 'SUB':
             return "DATE_SUB($field, INTERVAL $count $granularity)";
           }
+      case('sqlite'):
+        $direction = ($direction == 'ADD') ? '+' : '-';
+        switch ($this->date_type) {
+          case DATE_UNIX:
+            return "STRFTIME('s', $field, '$direction $count $granularity')";
+          case DATE_ISO:
+            return "STRFTIME('%Y-%m-%%dT%H:%M:%S', $field, '$direction $count $granularity')";
+          case DATE_DATETIME:
+            return "DATETIME($field, '$direction $count $granularity')";
+        }
 
       case 'pgsql':
         $granularity .= 'S';
@@ -307,6 +348,8 @@
           // WITH TIME ZONE assumes the date is using the system
           // timezone, which should have been set to UTC.
           return "TIMESTAMP WITH TIME ZONE $field AT TIME ZONE $localzone";
+        case 'sqlite':
+          // no support
       }
     }
   }
@@ -336,6 +379,18 @@
           );
         $format = strtr($format, $replace);
         return "DATE_FORMAT($field, '$format')";
+      case('sqlite'):
+        $replace = array(
+          'Y' => '%Y', 'y' => '%y',
+          'm' => '%m', 'n' => '%c',
+          'd' => '%%d', 'j' => '%j',
+          'H' => '%H',
+          'i' => '%M',
+          's' => '%S',
+          'WW' => '%W',
+          );
+        $format = strtr($format, $replace);
+        return "STRFTIME('$format', $field)";
       case 'pgsql':
         $replace = array(
           'Y' => 'YYYY', 'y' => 'Y',
@@ -387,6 +442,7 @@
           // WEEK using arg 3 in mysql should return the same value as postgres EXTRACT
           return "WEEK($field, 3)";
         case('pgsql'):
+        case('sqlite'):
           return "EXTRACT(WEEK FROM($field))";
       }
     case('DOW'):
@@ -397,6 +453,7 @@
           // php date functions and postgres use 0 for Sunday and 6 for Saturday
           return "INTEGER(DAYOFWEEK($field) - 1)";
         case('pgsql'):
+        case('sqlite'):
           return "EXTRACT(DOW FROM($field))";
       }
     case('DOY'):
@@ -405,6 +462,7 @@
         case('mysqli'):
           return "DAYOFYEAR($field)";
         case('pgsql'):
+        case('sqlite'):
           return "EXTRACT(DOY FROM($field))";
       }
     }

Reply

The content of this field is kept private and will not be shown publicly.
CAPTCHA
CoolSoft use reCAPTCHA: with this simple test you'll help digitize books, newspapers and old time radio shows.
More info: reCAPTCHA