| 21 | } |
| 22 | |
| 23 | bool CDatabaseFilter::contains(const QString& szKey) |
| 24 | { |
| 25 | bool bRet = false; |
| 26 | QSqlQuery query(GetDatabase()); |
| 27 | |
| 28 | // Check if it already exists |
| 29 | query.prepare("SELECT `key` FROM " + m_szTableName |
| 30 | + " WHERE `key` = :key " |
| 31 | ); |
| 32 | query.bindValue(":key", szKey); |
| 33 | bRet = query.exec(); |
| 34 | if(!bRet) { |
| 35 | qCritical(log) << "Failed to contains[" + szKey + "]:" |
| 36 | << query.lastError().text() |
| 37 | << "Sql:" << query.executedQuery(); |
| 38 | return false; |
| 39 | } |
| 40 | return query.next(); |
| 41 | } |
| 42 | |
| 43 | int CDatabaseFilter::AddKey(const QString &szKey) |
| 44 | { |
no outgoing calls
no test coverage detected