Page 1 of 1

CMS and database

Posted: Fri Mar 30, 2018 11:48 am
by mark_borman
Pable I wrote to you about table names in database created in CMS scripts and CMS plugins(about some OS not being able to tell the difference between uppercase and lowercase letters)
In this arangement as this is done moving working CMS with database is hard.
While everything worked fine with plugins before (changed manually) after next export sites don't work.
I don't want to rework everything manually again.
More about this https://dev.mysql.com/doc/refman/5.7/en ... ivity.html

I especially recomend you to pay attention to this:
"To avoid problems caused by such differences, it is best to adopt a consistent convention, such as always creating and referring to databases and tables using lowercase names. This convention is recommended for maximum portability and ease of use.

Whats the problem to configure the program to always create tables wrote with lowercase letters and not depending on the system which server uses for example "cms_pages","cms_PAGES","CMS_PAGES" because they are three different tables and if CMS worked fine previously on windows after moving it it doesn't and new tables are created for example instead of "cms_pages" will be created "CMS_PAGES"

PS
Additionally something like this appears in code of my site for object Administrator after line: "mysql_select_db($mysql_database, $db) or die('Failed to select database<br>'.mysql_error());"

I need to add:
mysql_query('SET NAMES "UTF8"', $db);
mysql_query("SET collation_connection='utf8_general_ci'", $db);
mysql_query("SET collation_server='utf8_general_ci'", $db);
mysql_query("SET character_set_client='utf8'", $db);
mysql_query("SET character_set_connection='utf8'", $db);
mysql_query("SET character_set_results='utf8'", $db);
mysql_query("SET character_set_server='utf8'", $db);
mysql_set_charset('utf8', $db);

I'm not going to dig into what this actually does but it works and polish characters show up fine after editing and saving the site.
As editor CKEditor, UTF-8 Unicode encoding (utf8) in program WWB character encoding for site Unicode(UTF-8).

Re: CMS and database

Posted: Fri Mar 30, 2018 11:57 am
by Pablo
The tables created by the scripts are always uppercase.
All references in the code are also uppercase. So, there should not be any issues unless you have changed the casing yourself.

I need to add:
mysql_query('SET NAMES "UTF8"', $db);
mysql_query("SET collation_connection='utf8_general_ci'", $db);
mysql_query("SET collation_server='utf8_general_ci'", $db);
mysql_query("SET character_set_client='utf8'", $db);
mysql_query("SET character_set_connection='utf8'", $db);
mysql_query("SET character_set_results='utf8'", $db);
mysql_query("SET character_set_server='utf8'", $db);
mysql_set_charset('utf8', $db);
If you enable Unicode support then this code will be automatically added for you...