コード例 #1
0
void PictureDao::update (Picture picture)
{
    m_database->open();

    PictureProperties properties = picture.pictureProperties();

    QString query ("UPDATE pictures SET ");

    query += "name='" + picture.name() + "',";
    query += "path=" + m_database->formatString( picture.path() ) + ",";

    query += "brightness=" + QString::number(properties.brightness) + ",";
    query += "contrast=" + QString::number(properties.contrast) + ",";
    query += "gamma=" + QString::number(properties.gamma) + ",";

    query += "wb_red=" + QString::number(properties.wb_red) + ",";
    query += "wb_green=" + QString::number(properties.wb_green) + ",";
    query += "wb_blue=" + QString::number(properties.wb_blue);

    query += " WHERE id=" + QString::number(picture.id()) + ";";

    qDebug() << query;

    m_database->exec( query );

    m_database->close();
}
コード例 #2
0
void PictureDao::remove (Picture picture)
{
    m_database->open();

    QString query ("DELETE FROM pictures WHERE id=");

    query += QString::number(picture.id()) + ";";

    m_database->exec( query );

    m_database->close();
}