phpmyadmin/libraries/classes/Database/Designer/DesignerTable.php
William Desportes a23f2ba51a
Fix some bugs with strange table and database names
- Fix export
- Fix split on . to have db and table
- Replace some $_REQUEST occurences
- Add translations to "add tables from another database" : "None" > strNone
- Refactor the ugly code that used globals to use an object "DesignerTable"
- Fix save a new added table
- Fix delete page items
- Fix more bugs

Fixes: #15446
Fixes: #13370
Fixes: #14945
Closes: #15438

Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-08-23 00:55:41 +02:00

89 lines
1.8 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Holds the PhpMyAdmin\Database\Designer\DesignerTable class
*
* @package PhpMyAdmin-Designer
*/
namespace PhpMyAdmin\Database\Designer;
use PhpMyAdmin\Util;
/**
* Common functions for Designer
*
* @package PhpMyAdmin-Designer
*/
class DesignerTable
{
private $tableName;
private $databaseName;
private $tableEngine;
private $displayField;
/**
* Create a new DesignerTable
*
* @param string $databaseName The database name
* @param string $tableName The table name
* @param string $tableEngine The table engine
* @param string|null $displayField The display field if available
*/
public function __construct(
$databaseName,
$tableName,
$tableEngine,
$displayField
) {
$this->databaseName = $databaseName;
$this->tableName = $tableName;
$this->tableEngine = $tableEngine;
$this->displayField = $displayField;
}
/**
* The table engine supports or not foreign keys
*
* @return bool
*/
public function supportsForeignkeys() {
return Util::isForeignKeySupported($this->tableEngine);
}
/**
* Get the database name
*
* @return string
*/
public function getDatabaseName() {
return $this->databaseName;
}
/**
* Get the table name
*
* @return string
*/
public function getTableName() {
return $this->tableName;
}
/**
* Get the table engine
*
* @return string
*/
public function getTableEngine() {
return $this->tableEngine;
}
/**
* Get the db and table speparated with a dot
*
* @return string
*/
public function getDbTableString() {
return $this->databaseName . '.' . $this->tableName;
}
}