diff --git a/ChangeLog b/ChangeLog index 01b7abe3..956f3dea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16399,3 +16399,8 @@ rd.conf(5). * Refactored the schema update code to use standard form in rdadmin(1). +2017-12-01 Fred Gleason + * Added a 'Charset=' directive to the [MySQL] section of + rd.conf(5). + * Added an 'Collation=' directive to the [MySQL] section of + rd.conf(5). diff --git a/conf/rd.conf-sample b/conf/rd.conf-sample index 6755a876..1855cdad 100644 --- a/conf/rd.conf-sample +++ b/conf/rd.conf-sample @@ -26,15 +26,11 @@ Password=letmein Database=Rivendell Driver=QMYSQL3 -; Specify the type of DB storage engine to use when creating new tables. -; To get a list of supported engine types, use the 'SHOW ENGINES;' command -; in mysql(1). -; -; It is also possible to specify 'default', in which case Rivendell will -; use whatever default engine type is configured in MySQL. -; -; The default value is 'default'. +; The following three settings control the attributes of new DB tables +; created by Rivendell. Engine=MyISAM +Charset=latin1 +Collation=latin1_swedish_ci [AudioStore] MountSource= diff --git a/lib/rd.h b/lib/rd.h index a1670345..cbc9399d 100644 --- a/lib/rd.h +++ b/lib/rd.h @@ -65,6 +65,8 @@ #define DEFAULT_MYSQL_DRIVER "QMYSQL3" #define DEFAULT_MYSQL_HEARTBEAT_INTERVAL 360 #define DEFAULT_MYSQL_ENGINE "default" +#define DEFAULT_MYSQL_CHARSET "latin1" +#define DEFAULT_MYSQL_COLLATION "latin1_swedish_ci" #define MYSQL_BUILTIN_DATABASE "mysql" #define POSTGRESQL_BUILTIN_DATABASE "template1" diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index e552056f..35f32682 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -187,6 +187,18 @@ QString RDConfig::mysqlEngine() const } +QString RDConfig::mysqlCharset() const +{ + return conf_mysql_charset; +} + + +QString RDConfig::mysqlCollation() const +{ + return conf_mysql_collation; +} + + QString RDConfig::createTablePostfix() const { return conf_create_table_postfix; @@ -571,12 +583,13 @@ void RDConfig::load() DEFAULT_MYSQL_HEARTBEAT_INTERVAL); conf_mysql_engine= profile->stringValue("mySQL","Engine",DEFAULT_MYSQL_ENGINE); - if(conf_mysql_engine.lower()=="default") { - conf_create_table_postfix=""; - } - else { - conf_create_table_postfix=QString(" engine ")+conf_mysql_engine; - } + conf_mysql_charset= + profile->stringValue("mySQL","Charset",DEFAULT_MYSQL_CHARSET); + conf_mysql_collation= + profile->stringValue("mySQL","Collation",DEFAULT_MYSQL_COLLATION); + conf_create_table_postfix=QString(" engine ")+conf_mysql_engine+" "+ + "character set "+conf_mysql_charset+" "+ + "collate "+conf_mysql_collation; facility=profile->stringValue("Logs","Facility",DEFAULT_LOG_FACILITY).lower(); if(facility=="syslog") { @@ -683,6 +696,8 @@ void RDConfig::clear() conf_mysql_driver=""; conf_mysql_heartbeat_interval=DEFAULT_MYSQL_HEARTBEAT_INTERVAL; conf_mysql_engine=DEFAULT_MYSQL_ENGINE; + conf_mysql_charset=DEFAULT_MYSQL_CHARSET; + conf_mysql_collation=DEFAULT_MYSQL_COLLATION; conf_create_table_postfix=""; conf_log_facility=RDConfig::LogSyslog; conf_log_directory=""; diff --git a/lib/rdconfig.h b/lib/rdconfig.h index 9ea7ad93..5f32238e 100644 --- a/lib/rdconfig.h +++ b/lib/rdconfig.h @@ -61,6 +61,8 @@ class RDConfig QString mysqlDriver() const; int mysqlHeartbeatInterval() const; QString mysqlEngine() const; + QString mysqlCharset() const; + QString mysqlCollation() const; QString createTablePostfix() const; RDConfig::LogFacility logFacility() const; QString logDirectory() const; @@ -127,6 +129,8 @@ class RDConfig QString conf_mysql_password; QString conf_mysql_driver; QString conf_mysql_engine; + QString conf_mysql_charset; + QString conf_mysql_collation; QString conf_create_table_postfix; int conf_mysql_heartbeat_interval; RDConfig::LogFacility conf_log_facility;