To manage database schemas, tables and columns, the plugin often generates HTML elements, CSS classes and JavaScript variables in the back-end with their original names. Unfortunately, MySQL, HTML, CSS and jQuery all have their own limitations, which can easily lead to errors or missing features. This page describes which characters can be used in schema, table and column names without breaking plugin features or running into name based errors.
Name validation #
Name validation was introduces in version 4.2.8 to help plugin users to identify erroneous names. Name validation is performed in the back-end only (Data Explorer, Data Tables, Data Projects, and so on). A red flag is shown when a schema, table or column names does not follow the general rules as mentioned below.
NOTE For performance reasons red flags are only shown at table level. Further research might be needed to identify the erroneous name.
General rules #
To prevent errors or missing plugin features, schema, table and column names should:
- Start with a letter
- Followed by any number of:
- Letters (upper or lower case)
- Digits 0 to 9
- Underscores (often used to replace white spaces)
- Be no longer than 64 characters
This works for all tools used in WP Data Access. To be safe, do not use anything else for names.
Example #
MySQL accepts white spaces in schema, tables and column names. HTML element names, CSS classes and JavaScript variables do not.
The following create table statement is allowed in MySQL:
create table my demo
(my id int not null auto_increment primary key
,my text text
);
The plugin however, will not be able to support all features with white spaces in the table and column name.
The following create table statement solves this issue:
create table my_demo
(my_id int not null auto_increment primary key
,my_text text
);
What to do if I get a red flag? #
- Check your schema, table, and column names
- Find the name(s) that do not follow the general rules
- Change the name
You might need to take additional actions for schema, table, and column names that are already used in data tables or projects. Please use the forum if you need help.
After upgrade to this new feature, all objects are flagged ! Even if table names and field names respect the rule.
… But the database name is as following : “123456_DatabaseName”, where “123456” is imposed by the website host !
No possibility for me to change the begin of the name of the database “123456…” !!!
Hi Roger,
Good point! ISP hosted databases may start with a number. And there is nothing you can do about it.
The plugin performs a couple of checks. It looks like the numeric check on the first character is only needed for HTML4. It’s not necessary for HTML5.
Can I presume WordPress generates HTML5 at all times? Anybody???
BTW, this is just a message! What worked will continue to work. Let me know if you have any issues.
Thanks,
Peter