How to use “central columns” in phpmyadmin?

2019-02-13 18:46发布

PMA has the tools for adding the central columns. As far as I understand, it's used with foreign constraints. I have two tables: TableA and TableB.

Structure of TableA: id_of_A, name_of_A_value, ...

Structure of TableB: id_of_B, foreign_id_of_A,... and foreign constraint from foreign_id_of_A to A-table.id_of_A.

And it's very difficult to select needed foreign_id_of_A while insert new row into TableB because only value of id_of_A is visible. Could central columns help me with this problem? How central column works?

3条回答
成全新的幸福
2楼-- · 2019-02-13 19:19

Central Column

You can add/remove columns to the list as per your requirement. These columns in the central list will be available to use while you create a new column for a table or create a table itself. You can select a column from central list while creating a new column, it will save you from writing the same column definition over again or from writing different names for similar column.

To allow the usage of this functionality:

  1. set up $cfg['Servers'][$i]['pmadb'] and the phpMyAdmin configuration storage

  2. put the table name in $cfg['Servers'][$i]['central_columns'] (e.g. pma__central_columns)

This feature can be disabled by setting the configuration to false.

查看更多
beautiful°
3楼-- · 2019-02-13 19:29

Perhaps the feature that you are looking for is the "Display Column" under "Relation View" in the table structure view. This allows you to choose what column is shown in the PHPMyAdmin interface regardless of what is stored in the database foreign key constraint.

If the line is not shown than you need to enable the feature in PHPMyAdmin. See the FAQ Entry and relevant configuration option entries: $cfg["servers"][$i]["relation"] and $cfg["servers"][$i]["table_info"] (in the previous link, at the time of posting (I don't have enough reputation to post more than 2 links)).

Essentially you create a couple of tables in a database that PHPMyAdmin can use to store additional data and then tell it which tables these are. Once this is done PHPMyAdmin will let you choose which columns to display (on mouse over of the linked column, and while editing data). If you installed it on a Linux distribution via a package manager it should have already created these tables for you (or at least asked you if you wanted to), if it did not, re-installing the package may help. I don't have any experience with installing it on Windows or Mac OS X, but I would presume that there is some automated method of creating these tables for those platforms.

(On Debian and Debian-based Linux Distributions (such as Ubuntu), the extra database is configured with db-config-common. If it was not configured at install time, dpkg-reconfigure phpmyadmin will allow you to set up the database (please note that this might destroy some user/system preferences in PHPMyAdmin).)

查看更多
We Are One
4楼-- · 2019-02-13 19:39

I've found here is an exhaustive description:

As the name suggests, the Central columns feature enables to maintain a central list of columns per database to avoid similar name for the same data element and bring consistency of data type for the same data element. You can use the central list of columns to add an element to any table structure in that database which will save from writing similar column name and column definition.

To add a column to central list, go to table structure page, check the columns you want to include and then simply click on “Add to central columns”. If you want to add all unique columns from more than one table from a database then go to database structure page, check the tables you want to include and then select “Add columns to central list”.

To remove a column from central list, go to Table structure page, check the columns you want to remove and then simply click on “Remove from central columns”. If you want to remove all columns from more than one tables from a database then go to database structure page, check the tables you want to include and then select “Remove columns from central list”.

To view and manage the central list, select the database you want to manage central columns for then from the top menu click on “Central columns”. You will be taken to a page where you will have options to edit, delete or add new columns to central list.

http://lees.geo.msu.edu/phpmyadmin/doc/html/faq.html

May be it's useful for foreign constraints modelling, but absolutly useless in usage. I'm still looking for a solution for adding value into one table by the ID from another table so that it was understandable for people, not for computers. If you know how to do that, let me know.

查看更多
登录 后发表回答