alecpl
2010-04-01 70318e5463986edff014e881e7e121483679726b
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;
  }