Ticket #1697: mythtv-0.19.dbport.txt

File mythtv-0.19.dbport.txt, 4.5 KB (added by mrsam@…, 13 years ago)

Patch file

Line 
1--- libs/libmyth/dbsettings.cpp.db      2005-03-04 19:00:39.000000000 -0500
2+++ libs/libmyth/dbsettings.cpp 2006-04-15 16:59:24.000000000 -0400
3@@ -48,6 +48,7 @@
4 protected:
5     TransientLabel    *info;
6     TransientLineEdit *dbHostName;
7+    TransientLineEdit *dbPort;
8     TransientLineEdit *dbName;
9     TransientLineEdit *dbUserName;
10     TransientLineEdit *dbPassword;
11@@ -130,6 +131,13 @@
12                                         "the machine hosting the database. "
13                                         "This information is required."));
14     addChild(dbHostName);
15+
16+    dbPort = new TransientLineEdit(true);
17+    dbPort->setLabel(QObject::tr("Host Port"));
18+    dbPort->setHelpText(QObject::tr("The port number the database is running "
19+                                    "on, if it's not the default database "
20+                                    "port."));
21+    addChild(dbPort);
22     
23     dbName = new TransientLineEdit(true);
24     dbName->setLabel(QObject::tr("Database"));
25@@ -245,6 +253,10 @@
26     dbHostName->setValue(params.dbHostName);
27     if (params.dbHostName.isEmpty())
28         dbHostName->setLabel("* " + dbHostName->getLabel());
29+
30+    if (params.dbPort)
31+        dbPort->setValue(QString::number(params.dbPort));
32+
33     dbUserName->setValue(params.dbUserName);
34     if (params.dbUserName.isEmpty())
35         dbUserName->setLabel("* " + dbUserName->getLabel());
36@@ -279,6 +291,7 @@
37     DatabaseParams params = gContext->GetDatabaseParams();
38     
39     params.dbHostName    = dbHostName->getValue();
40+    params.dbPort        = dbPort->getValue().toInt();
41     params.dbUserName    = dbUserName->getValue();
42     params.dbPassword    = dbPassword->getValue();
43     params.dbName        = dbName->getValue();
44--- libs/libmyth/mythcontext.cpp.db     2006-01-25 05:22:57.000000000 -0500
45+++ libs/libmyth/mythcontext.cpp        2006-04-15 17:01:10.000000000 -0400
46@@ -590,8 +590,12 @@
47     
48     VERBOSE(VB_IMPORTANT, QString("Writing settings file %1").arg(path));
49     QTextStream s(f);
50-    s << "DBHostName=" << params.dbHostName << endl
51-      << "DBUserName=" << params.dbUserName << endl
52+    s << "DBHostName=" << params.dbHostName << endl;
53+
54+    if (params.dbPort)
55+      s << "DBPort=" << params.dbPort << endl;
56+
57+    s << "DBUserName=" << params.dbUserName << endl
58       << "DBPassword=" << params.dbPassword << endl
59       << "DBName="     << params.dbName     << endl
60       << "DBType="     << params.dbType     << endl
61@@ -752,6 +756,8 @@
62         
63         params.dbHostName = getResponse("Database host name:",
64                                         params.dbHostName);
65+        params.dbPort = intResponse("Database non-default port:",
66+                                    params.dbPort);
67         params.dbName     = getResponse("Database name:",
68                                         params.dbName);
69         params.dbUserName = getResponse("Database user name:",
70@@ -2730,6 +2736,7 @@
71     DatabaseParams params;
72     
73     params.dbHostName = d->m_settings->GetSetting("DBHostName", "localhost");
74+    params.dbPort     = d->m_settings->GetNumSetting("DBPort", 0);
75     params.dbUserName = d->m_settings->GetSetting("DBUserName", "mythtv");
76     params.dbPassword = d->m_settings->GetSetting("DBPassword", "mythtv");
77     params.dbName     = d->m_settings->GetSetting("DBName",     "mythconverg");
78@@ -2766,6 +2773,7 @@
79     
80     // only rewrite file if it has changed
81     if (params.dbHostName   != cur_params.dbHostName          ||
82+        params.dbPort       != cur_params.dbPort              ||
83         params.dbUserName   != cur_params.dbUserName          ||
84         params.dbPassword   != cur_params.dbPassword          ||
85         params.dbName       != cur_params.dbName              ||
86--- libs/libmyth/mythcontext.h.db       2006-01-21 23:29:43.000000000 -0500
87+++ libs/libmyth/mythcontext.h  2006-04-15 16:45:22.000000000 -0400
88@@ -130,6 +130,7 @@
89 struct DatabaseParams
90 {
91     QString dbHostName;         ///< database server
92+    int     dbPort;             ///< database port
93     QString dbUserName;         ///< DB user name
94     QString dbPassword;         ///< DB password
95     QString dbName;             ///< database name
96--- libs/libmyth/mythdbcon.cpp.db       2006-02-03 17:24:39.000000000 -0500
97+++ libs/libmyth/mythdbcon.cpp  2006-04-15 16:51:12.000000000 -0400
98@@ -55,6 +55,8 @@
99         m_db->setUserName(dbparms.dbUserName);
100         m_db->setPassword(dbparms.dbPassword);
101         m_db->setHostName(dbparms.dbHostName);
102+        if (dbparms.dbPort)
103+            m_db->setPort(dbparms.dbPort);
104         connected = m_db->open();
105 
106         if (!connected && dbparms.wolEnabled)