Changeset View
Changeset View
Standalone View
Standalone View
src/server/storage/querybuilder.cpp
Show First 20 Lines • Show All 361 Lines • ▼ Show 20 Line(s) | 360 | { | |||
---|---|---|---|---|---|
362 | statement.reserve(1024); | 362 | statement.reserve(1024); | ||
363 | buildQuery(&statement); | 363 | buildQuery(&statement); | ||
364 | 364 | | |||
365 | #ifndef QUERYBUILDER_UNITTEST | 365 | #ifndef QUERYBUILDER_UNITTEST | ||
366 | if (QueryCache::contains(statement)) { | 366 | if (QueryCache::contains(statement)) { | ||
367 | mQuery = QueryCache::query(statement); | 367 | mQuery = QueryCache::query(statement); | ||
368 | } else { | 368 | } else { | ||
369 | mQuery.clear(); | 369 | mQuery.clear(); | ||
370 | mQuery.prepare(statement); | 370 | if (!mQuery.prepare(statement)) { | ||
371 | qCCritical(AKONADISERVER_LOG) << "DATABASE ERROR while PREPARING QUERY:"; | ||||
372 | qCCritical(AKONADISERVER_LOG) << " Error code:" << mQuery.lastError().nativeErrorCode(); | ||||
373 | qCCritical(AKONADISERVER_LOG) << " DB error: " << mQuery.lastError().databaseText(); | ||||
374 | qCCritical(AKONADISERVER_LOG) << " Error text:" << mQuery.lastError().text(); | ||||
375 | qCCritical(AKONADISERVER_LOG) << " Query:" << statement; | ||||
376 | return false; | ||||
377 | } | ||||
371 | QueryCache::insert(statement, mQuery); | 378 | QueryCache::insert(statement, mQuery); | ||
372 | } | 379 | } | ||
373 | 380 | | |||
374 | //too heavy debug info but worths to have from time to time | 381 | //too heavy debug info but worths to have from time to time | ||
375 | //qCDebug(AKONADISERVER_LOG) << "Executing query" << statement; | 382 | //qCDebug(AKONADISERVER_LOG) << "Executing query" << statement; | ||
376 | bool isBatch = false; | 383 | bool isBatch = false; | ||
377 | for (int i = 0; i < mBindValues.count(); ++i) { | 384 | for (int i = 0; i < mBindValues.count(); ++i) { | ||
378 | mQuery.bindValue(QLatin1Char(':') + QString::number(i), mBindValues[i]); | 385 | mQuery.bindValue(QLatin1Char(':') + QString::number(i), mBindValues[i]); | ||
▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines |