~ubuntu-branches/ubuntu/lucid/mythtv/lucid

« back to all changes in this revision

Viewing changes to libs/libmythdb/mythdb.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello, Mario Limonciello, John Baab
  • Date: 2009-09-29 01:33:23 UTC
  • mfrom: (1.1.35 upstream)
  • Revision ID: james.westby@ubuntu.com-20090929013323-6pvn8encm757zbxw
Tags: 0.22.0~trunk22101-0ubuntu1
[ Mario Limonciello ]
* New upstream checkout (r22101)
* Try to guard and make sure that ~mythtv is read from /etc/passwd 
  rather than assuming it's /home/mythtv.

[ John Baab ]
* debian/mythtv-common.postinst:
  - Added symlink for /home/mythtv/.mythtv/config.xml

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <QMutex>
2
2
#include <QHash>
 
3
#include <QSqlError>
3
4
 
4
5
#include "mythdb.h"
5
6
#include "mythdbcon.h"
58
59
 
59
60
    bool ignoreDatabase;
60
61
    bool useSettingsCache;
 
62
    bool suppressDBMessages;
61
63
    QMutex settingsCacheLock;
62
64
    QHash <QString, QString> settingsCache;      // permanent settings in the DB
63
65
    QHash <QString, QString> overriddenSettings; // overridden this session only
67
69
 
68
70
MythDBPrivate::MythDBPrivate()
69
71
    : m_settings(new Settings()),
70
 
      ignoreDatabase(false), useSettingsCache(false)
 
72
      ignoreDatabase(false), useSettingsCache(false), suppressDBMessages(true)
71
73
{
72
74
    m_localhostname.clear();
73
75
    settingsCache.reserve(settings_reserve);
193
195
    return d->ignoreDatabase;
194
196
}
195
197
 
 
198
void MythDB::SetSuppressDBMessages(bool bUpgraded)
 
199
{
 
200
    d->suppressDBMessages = bUpgraded;
 
201
}
 
202
 
 
203
bool MythDB::SuppressDBMessages(void) const
 
204
{
 
205
    return d->suppressDBMessages;
 
206
}
 
207
 
196
208
 
197
209
void MythDB::SaveSetting(const QString &key, int newValue)
198
210
{
247
259
        if (!host.isEmpty())
248
260
            query.bindValue(":HOSTNAME", host);
249
261
 
250
 
        if (!query.exec() || !query.isActive())
 
262
        if (!query.exec() && !(GetMythDB()->SuppressDBMessages()))
251
263
            MythDB::DBError("Clear setting", query);
252
264
 
253
265
        if (!host.isEmpty())
262
274
        if (!host.isEmpty())
263
275
            query.bindValue(":HOSTNAME", host);
264
276
 
265
 
        if (!query.exec() || !query.isActive())
 
277
        if (query.exec())
 
278
            success = true;
 
279
        else if (!(GetMythDB()->SuppressDBMessages()))
266
280
            MythDB::DBError(LOC + "- query failure: ", query);
267
 
        else
268
 
            success = true;
269
281
    }
270
282
    else
271
283
    {