2017-12-01 Fred Gleason <fredg@paravelsystems.com>

* Added a 'Charset=' directive to the [MySQL] section of
	rd.conf(5).
	* Added an 'Collation=' directive to the [MySQL] section of
	rd.conf(5).
This commit is contained in:
Fred Gleason
2017-12-01 18:14:07 -05:00
parent a8ae9f9bfa
commit 9f17b3f560
5 changed files with 36 additions and 14 deletions

View File

@@ -16399,3 +16399,8 @@
rd.conf(5). rd.conf(5).
* Refactored the schema update code to use standard form * Refactored the schema update code to use standard form
in rdadmin(1). in rdadmin(1).
2017-12-01 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Charset=' directive to the [MySQL] section of
rd.conf(5).
* Added an 'Collation=' directive to the [MySQL] section of
rd.conf(5).

View File

@@ -26,15 +26,11 @@ Password=letmein
Database=Rivendell Database=Rivendell
Driver=QMYSQL3 Driver=QMYSQL3
; Specify the type of DB storage engine to use when creating new tables. ; The following three settings control the attributes of new DB tables
; To get a list of supported engine types, use the 'SHOW ENGINES;' command ; created by Rivendell.
; 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'.
Engine=MyISAM Engine=MyISAM
Charset=latin1
Collation=latin1_swedish_ci
[AudioStore] [AudioStore]
MountSource= MountSource=

View File

@@ -65,6 +65,8 @@
#define DEFAULT_MYSQL_DRIVER "QMYSQL3" #define DEFAULT_MYSQL_DRIVER "QMYSQL3"
#define DEFAULT_MYSQL_HEARTBEAT_INTERVAL 360 #define DEFAULT_MYSQL_HEARTBEAT_INTERVAL 360
#define DEFAULT_MYSQL_ENGINE "default" #define DEFAULT_MYSQL_ENGINE "default"
#define DEFAULT_MYSQL_CHARSET "latin1"
#define DEFAULT_MYSQL_COLLATION "latin1_swedish_ci"
#define MYSQL_BUILTIN_DATABASE "mysql" #define MYSQL_BUILTIN_DATABASE "mysql"
#define POSTGRESQL_BUILTIN_DATABASE "template1" #define POSTGRESQL_BUILTIN_DATABASE "template1"

View File

@@ -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 QString RDConfig::createTablePostfix() const
{ {
return conf_create_table_postfix; return conf_create_table_postfix;
@@ -571,12 +583,13 @@ void RDConfig::load()
DEFAULT_MYSQL_HEARTBEAT_INTERVAL); DEFAULT_MYSQL_HEARTBEAT_INTERVAL);
conf_mysql_engine= conf_mysql_engine=
profile->stringValue("mySQL","Engine",DEFAULT_MYSQL_ENGINE); profile->stringValue("mySQL","Engine",DEFAULT_MYSQL_ENGINE);
if(conf_mysql_engine.lower()=="default") { conf_mysql_charset=
conf_create_table_postfix=""; profile->stringValue("mySQL","Charset",DEFAULT_MYSQL_CHARSET);
} conf_mysql_collation=
else { profile->stringValue("mySQL","Collation",DEFAULT_MYSQL_COLLATION);
conf_create_table_postfix=QString(" engine ")+conf_mysql_engine; 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(); facility=profile->stringValue("Logs","Facility",DEFAULT_LOG_FACILITY).lower();
if(facility=="syslog") { if(facility=="syslog") {
@@ -683,6 +696,8 @@ void RDConfig::clear()
conf_mysql_driver=""; conf_mysql_driver="";
conf_mysql_heartbeat_interval=DEFAULT_MYSQL_HEARTBEAT_INTERVAL; conf_mysql_heartbeat_interval=DEFAULT_MYSQL_HEARTBEAT_INTERVAL;
conf_mysql_engine=DEFAULT_MYSQL_ENGINE; conf_mysql_engine=DEFAULT_MYSQL_ENGINE;
conf_mysql_charset=DEFAULT_MYSQL_CHARSET;
conf_mysql_collation=DEFAULT_MYSQL_COLLATION;
conf_create_table_postfix=""; conf_create_table_postfix="";
conf_log_facility=RDConfig::LogSyslog; conf_log_facility=RDConfig::LogSyslog;
conf_log_directory=""; conf_log_directory="";

View File

@@ -61,6 +61,8 @@ class RDConfig
QString mysqlDriver() const; QString mysqlDriver() const;
int mysqlHeartbeatInterval() const; int mysqlHeartbeatInterval() const;
QString mysqlEngine() const; QString mysqlEngine() const;
QString mysqlCharset() const;
QString mysqlCollation() const;
QString createTablePostfix() const; QString createTablePostfix() const;
RDConfig::LogFacility logFacility() const; RDConfig::LogFacility logFacility() const;
QString logDirectory() const; QString logDirectory() const;
@@ -127,6 +129,8 @@ class RDConfig
QString conf_mysql_password; QString conf_mysql_password;
QString conf_mysql_driver; QString conf_mysql_driver;
QString conf_mysql_engine; QString conf_mysql_engine;
QString conf_mysql_charset;
QString conf_mysql_collation;
QString conf_create_table_postfix; QString conf_create_table_postfix;
int conf_mysql_heartbeat_interval; int conf_mysql_heartbeat_interval;
RDConfig::LogFacility conf_log_facility; RDConfig::LogFacility conf_log_facility;