~ubuntu-branches/ubuntu/jaunty/quassel/jaunty

« back to all changes in this revision

Viewing changes to src/core/abstractsqlstorage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2008-11-17 15:22:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20081117152246-3lwlpnr4r08910kv
Tags: 0.3.1-0ubuntu1
* New upstream release (LP: #271403)
* Drop all patches originated from upstream (quassel_*)
* Compile with non-builtin quassel icons
  + Introduce new quassel-data package
  + quassel and quassel-client depend on quassel-data
  + Don't manually enforce icon installation for desktop files in debian/rules
  + Add quassel_01_fix_iconloader.patch
* Drop perl build dependency, I have no clue why it was added in the first
  place. Neither changelog nor Bazaar knows, and since quassel compiles just
  fine without it, removing it should be save.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    return db;
53
53
 
54
54
  if(!openDb()) {
55
 
    quWarning() << "Unable to Open Database" << displayName();
56
 
    quWarning() << "-" << db.lastError().text();
 
55
    qWarning() << "Unable to Open Database" << displayName();
 
56
    qWarning() << "-" << db.lastError().text();
57
57
  }
58
58
 
59
59
  return QSqlDatabase::database("quassel_connection");
85
85
    return false;
86
86
 
87
87
  if(installedSchemaVersion() == -1) {
88
 
    quError() << "Storage Schema is missing!";
 
88
    qCritical() << "Storage Schema is missing!";
89
89
    return false;
90
90
  }
91
91
 
92
92
  if(installedSchemaVersion() > schemaVersion()) {
93
 
    quError() << "Installed Schema is newer then any known Version.";
 
93
    qCritical() << "Installed Schema is newer then any known Version.";
94
94
    return false;
95
95
  }
96
96
  
97
97
  if(installedSchemaVersion() < schemaVersion()) {
98
 
    quWarning() << "Installed Schema is not up to date. Upgrading...";
 
98
    qWarning() << "Installed Schema is not up to date. Upgrading...";
99
99
    if(!upgradeDb())
100
100
      return false;
101
101
  }
120
120
    
121
121
  QFileInfo queryInfo(QString(":/SQL/%1/%2/%3.sql").arg(displayName()).arg(version).arg(queryName));
122
122
  if(!queryInfo.exists() || !queryInfo.isFile() || !queryInfo.isReadable()) {
123
 
    quError() << "Unable to read SQL-Query" << queryName << "for engine" << displayName();
 
123
    qCritical() << "Unable to read SQL-Query" << queryName << "for engine" << displayName();
124
124
    return QString();
125
125
  }
126
126
 
164
164
  Q_UNUSED(settings)
165
165
  QSqlDatabase db = logDb();
166
166
  if(!db.isOpen()) {
167
 
    quError() << "Unable to setup Logging Backend!";
 
167
    qCritical() << "Unable to setup Logging Backend!";
168
168
    return false;
169
169
  }
170
170
 
171
171
  foreach(QString queryString, setupQueries()) {
172
172
    QSqlQuery query = db.exec(queryString);
173
173
    if(!watchQuery(&query)) {
174
 
      quError() << "Unable to setup Logging Backend!";
 
174
      qCritical() << "Unable to setup Logging Backend!";
175
175
      return false;
176
176
    }
177
177
  }
197
197
    foreach(QString queryString, upgradeQueries(ver)) {
198
198
      QSqlQuery query = db.exec(queryString);
199
199
      if(!watchQuery(&query)) {
200
 
        quError() << "Unable to upgrade Logging Backend!";
 
200
        qCritical() << "Unable to upgrade Logging Backend!";
201
201
        return false;
202
202
      }
203
203
    }
231
231
 
232
232
bool AbstractSqlStorage::watchQuery(QSqlQuery *query) {
233
233
  if(query->lastError().isValid()) {
234
 
    quError() << "unhandled Error in QSqlQuery!";
235
 
    quError() << "                  last Query:\n" << query->lastQuery();
236
 
    quError() << "              executed Query:\n" << query->executedQuery();
237
 
    quError() << "                bound Values:";
 
234
    qCritical() << "unhandled Error in QSqlQuery!";
 
235
    qCritical() << "                  last Query:\n" << query->lastQuery();
 
236
    qCritical() << "              executed Query:\n" << query->executedQuery();
 
237
    qCritical() << "                bound Values:";
238
238
    QList<QVariant> list = query->boundValues().values();
239
239
    for (int i = 0; i < list.size(); ++i)
240
 
      quError() << i << ": " << list.at(i).toString().toAscii().data();
241
 
    quError() << "                Error Number:"   << query->lastError().number();
242
 
    quError() << "               Error Message:"   << query->lastError().text();
243
 
    quError() << "              Driver Message:"   << query->lastError().driverText();
244
 
    quError() << "                  DB Message:"   << query->lastError().databaseText();
 
240
      qCritical() << i << ": " << list.at(i).toString().toAscii().data();
 
241
    qCritical() << "                Error Number:"   << query->lastError().number();
 
242
    qCritical() << "               Error Message:"   << query->lastError().text();
 
243
    qCritical() << "              Driver Message:"   << query->lastError().driverText();
 
244
    qCritical() << "                  DB Message:"   << query->lastError().databaseText();
245
245
    
246
246
    return false;
247
247
  }