/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/cache/cachedb.php

  • Committer: Suren A. Chilingaryan
  • Date: 2009-03-07 09:12:49 UTC
  • Revision ID: csa@dside.dyndns.org-20090307091249-0f76jvezb277fomn
Support for dates prior to Jan 01, 1970

Show diffs side-by-side

added added

removed removed

Lines of Context:
832
832
 function GetTableInfo($resolution = 0, $postfix = false, $flags = 0) {
833
833
    $table = $this->GetTableName($resolution, $postfix);
834
834
    
835
 
    $req = "UNIX_TIMESTAMP(MIN(time)) AS first, UNIX_TIMESTAMP(MAX(time)) AS last";
 
835
    $req = "EXTENDED_UNIX_TIMESTAMP(MIN(time)) AS first, EXTENDED_UNIX_TIMESTAMP(MAX(time)) AS last";
836
836
    if ($flags&REQUEST::NEED_COUNT) $req .= ", COUNT(time) AS records";
837
837
 
838
838
    $res = mysql_query("SELECT $req FROM `$table`", $this->dbh);
909
909
    if ((!mysql_query($query, $this->dbh))&&(mysql_errno($this->dbh) != CACHEDB::MYSQL_ER_SP_ALREADY_EXISTS)) {
910
910
        throw new ADEIException(translate("CACHE is not able to create stored procedure (%s), error: %s", "ADEI_TIMESTAMP", mysql_error($this->dbh)));
911
911
    }
 
912
 
 
913
    $query = "CREATE FUNCTION EXTENDED_UNIX_TIMESTAMP(dt DATETIME) RETURNS BIGINT DETERMINISTIC RETURN TIMESTAMPDIFF(SECOND, '1970-01-01 00:00:00+00', dt)";
 
914
    if ((!mysql_query($query, $this->dbh))&&(mysql_errno($this->dbh) != CACHEDB::MYSQL_ER_SP_ALREADY_EXISTS)) {
 
915
        throw new ADEIException(translate("CACHE is not able to create stored procedure (%s), error: %s", "EXTENDED_UNIX_TIMESTAMP", mysql_error($this->dbh)));
 
916
    }
912
917
 }
913
918
 
914
919
 function CreateTable($resolution, $items, $postfix = false) {