alecpl
2010-04-23 373747becc9324f294980923a77b5ccffb5f3124
program/include/rcube_mdb2.php
@@ -35,8 +35,6 @@
 */
class rcube_mdb2
  {
  private static $tables;
  var $db_dsnw;               // DSN for write operations
  var $db_dsnr;               // DSN for read operations
  var $db_connected = false;  // Already connected ?
@@ -48,6 +46,8 @@
  var $a_query_results = array('dummy');
  var $last_res_id = 0;
  private $tables;
  /**
@@ -403,23 +403,15 @@
  function list_tables()
  {
    // get tables if not cached
    if (!self::$tables) {
      self::$tables = array();
      switch ($this->db_provider) {
        case 'sqlite':
          $result = $this->db_handle->query("SELECT name FROM sqlite_master WHERE type='table'");
          break;
        default:
          $result = $this->db_handle->query("SHOW TABLES");
      }
      if ($result !== false && !PEAR::isError($result))
        while ($rec = $result->fetchRow(MDB2_FETCHMODE_ORDERED))
          self::$tables[] = $rec[0];
    if (!$this->tables) {
      $this->db_handle->loadModule('Manager');
      if (!PEAR::isError($result = $this->db_handle->listTables()))
        $this->tables = $result;
      else
        $this->tables = array();
    }
    return self::$tables;
    return $this->tables;
  }
@@ -744,8 +736,7 @@
{
  if ($scope != 'prepare')
  {
    $debug_output = $scope . '('.$db->db_index.'): ';
    $debug_output .= $message . $db->getOption('log_line_break');
    $debug_output = $scope . '('.$db->db_index.'): ' . $message;
    write_log('sql', $debug_output);
  }
}