alecpl
2008-10-07 2727053c61cac4a37a76b9e58e607acff7fc8dfb
program/include/rcube_mdb2.php
@@ -69,17 +69,6 @@
  /**
   * PHP 4 object constructor
   *
   * @see  rcube_mdb2::__construct
   */
  function rcube_db($db_dsnw,$db_dsnr='')
    {
    $this->__construct($db_dsnw,$db_dsnr);
    }
  /**
   * Connect to specific database
   *
   * @param  string  DSN for DB connections
@@ -500,10 +489,31 @@
      case 'mysqli':
      case 'mysql':
      case 'sqlite':
        return "FROM_UNIXTIME($timestamp)";
        return sprintf("FROM_UNIXTIME(%d)", $timestamp);
      default:
        return date("'Y-m-d H:i:s'", $timestamp);
      }
    }
  /**
   * Return SQL statement for case insensitive LIKE
   *
   * @param  string  Field name
   * @param  string  Search value
   * @return string  SQL statement to use in query
   * @access public
   */
  function ilike($column, $value)
    {
    // TODO: use MDB2's matchPattern() function
    switch($this->db_provider)
      {
      case 'pgsql':
        return $this->quote_identifier($column).' ILIKE '.$this->quote($value);
      default:
        return $this->quote_identifier($column).' LIKE '.$this->quote($value);
      }
    }
@@ -566,12 +576,7 @@
    if (empty($file_name) || !is_string($file_name))
      return;
    $data = '';
    if ($fd = fopen($file_name, 'r'))
      {
      $data = fread($fd, filesize($file_name));
      fclose($fd);
      }
    $data = file_get_contents($file_name);
    if (strlen($data))
      sqlite_exec($dbh->connection, $data);