Ejemplo n.º 1
0
 /**
  * Obtain a list of a given type of objects
  *
  * @param string $type  the kind of objects you want to retrieve
  *
  * @return array  the array containing the list of objects requested
  *
  * @access protected
  * @see DB_common::getListOf()
  */
 function getSpecialQuery($type)
 {
     switch ($type) {
         case 'databases':
             $id = @msql_list_dbs($this->connection);
             break;
         case 'tables':
             $id = @msql_list_tables($this->dsn['database'], $this->connection);
             break;
         default:
             return null;
     }
     if (!$id) {
         return $this->msqlRaiseError();
     }
     $out = array();
     while ($row = @msql_fetch_row($id)) {
         $out[] = $row[0];
     }
     return $out;
 }
 /**
  * db::list_tables()
  * 
  * @param $dbname
  * @return 
  **/
 function list_tables($dbname)
 {
     global $GonxAdmin;
     switch ($GonxAdmin["dbtype"]) {
         case "mysql":
             $this->dbResultLine = @mysql_list_tables($dbname);
             break;
         case "postgresql":
             $sql = "SELECT relname FROM pg_class WHERE relname !~ '^pg_'";
             $this->dbResultLine = $this->query($sql);
             break;
         case "oracle":
             $sql = "select * from user_objects where object_type = 'TABLE';";
             $this->dbResultLine = $this->query($sql);
             break;
         case "sqlite":
             break;
         case "mssql":
             $this->dbResultLine = @msql_list_tables($dbname);
             break;
     }
     // switch
     return $this->dbResultLine;
 }