void SQLitePersister::saveCampaignMapParameters (const CampaignMap* map, SQLiteStatement& stmt)
{
	stmt.bindText(2, map->getId());
	stmt.bindInt(3, map->isLocked() ? 1 : 0);
	stmt.bindInt(4, map->getTime());
	stmt.bindInt(5, map->getFinishPoints());
	stmt.bindInt(6, map->getStars());
}
bool SQLitePersister::saveLives (uint8_t lives, const std::string& campaignId)
{
	SQLiteStatement stmt;
	prepare(stmt, "INSERT OR REPLACE INTO " TABLE_LIVES " (campaignid, lives, version) VALUES (?, ?, ?);");
	if (!stmt)
		return false;

	stmt.bindText(1, campaignId);
	stmt.bindInt(2, lives);
	stmt.bindText(3, Singleton<Application>::getInstance().getVersion());
	stmt.step();
	Log::info(LOG_CAMPAIGN, "update lives in database %i", static_cast<int>(lives));
	return true;
}
Exemple #3
0
// Returns number of items bound.
static int bindKey(SQLiteStatement& query, int column, IDBKey* key)
{
    switch (key->type()) {
    case IDBKey::StringType:
        query.bindText(column, key->string());
        return 1;
    case IDBKey::NumberType:
        query.bindInt(column, key->number());
        return 1;
    // FIXME: Implement date.
    case IDBKey::NullType:
        return 0;
    }

    ASSERT_NOT_REACHED();
    return 0;
}