/** * @brief Adds a playlist to the database. * * @param Playlist * @return bool */ bool DatabaseManager::insertNewPlaylist(Playlist &playlist) { QSqlQuery l_query(m_db); l_query.prepare("INSERT INTO playlists (name, creation_date, rate) " "VALUES (:name, :creation_date, :rate)"); l_query.bindValue(":name", playlist.name()); l_query.bindValue(":creation_date", playlist.creationDate().toTime_t()); l_query.bindValue(":rate", playlist.rate()); if (!l_query.exec()) { Macaw::DEBUG("In insertNewPlaylist():"); Macaw::DEBUG(l_query.lastError().text()); return false; } playlist.setId(l_query.lastInsertId().toInt()); return true; }