예제 #1
0
파일: Table.php 프로젝트: promoso/HVAC
 /**
  * Neither INNODB tables nor views store the last updated time
  * inside of MySQL.  This wreaks havoc on caching, so we create
  * our own backup table called dataface__mtimes as a fallback
  * mechanism to track uptime times of tables.  The down side
  * is that it only updates the timestamp when a change is made
  * via Xataface.  Outside changes aren't tracked.
  *
  * @see Dataface_IO::createModificationTimesTable()
  * @see Dataface_IO::touchTable($tablename)
  */
 public static function &getBackupModificationTimes($refresh = false)
 {
     $backup_times = 0;
     if ($backup_times === 0 or $refresh) {
         $res = mysql_query("select * from dataface__mtimes", df_db());
         if (!$res) {
             import('Dataface/IO.php');
             Dataface_IO::createModificationTimesTable();
             $res = mysql_query("select * from dataface__mtimes", df_db());
             if (!$res) {
                 throw new Exception(mysql_error(df_db()));
             }
         }
         $backup_times = array();
         while ($row = mysql_fetch_assoc($res)) {
             $backup_times[$row['name']] = $row['mtime'];
         }
         @mysql_free_result($res);
     }
     return $backup_times;
 }