本文整理汇总了C++中Playlist::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Playlist::name方法的具体用法?C++ Playlist::name怎么用?C++ Playlist::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPlaylist
bool Database::addPlaylist(const Playlist &playlist)
{
try
{
_work.parameterized("INSERT INTO playlists (user_id, name, is_public) VALUES ($1, $2, $3);")
(playlist.userId())(playlist.name())(playlist.isPublic()).exec();
}
catch (const pqxx::unique_violation &e)
{
return false;
}
return true;
}
示例2: insertNewPlaylist
/**
* @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;
}
示例3: updatePlaylist
UpdateStatus Database::updatePlaylist(const Playlist &playlist)
{
pqxx::result res;
try
{
res = _work.parameterized("UPDATE playlists "
"SET name=$1, "
"is_public=$2 "
"WHERE id=$3 "
" AND user_id=$4;")
(playlist.name())(playlist.isPublic())
(playlist.id())(playlist.userId()).exec();
}
catch (const pqxx::unique_violation &e)
{
return UpdateStatus::CONFLICT;
}
return res.affected_rows() == 1 ? UpdateStatus::UPDATED : UpdateStatus::NOT_FOUND;
}