void
Repeater::do_load()
{
    SQLStatement statement
    (   database_connection(),
        "select interval_units, interval_type_id, next_date, journal_id "
        "from repeaters where repeater_id = :p"
    );
    statement.bind(":p", id());
    statement.step();
    Repeater temp(*this);
    temp.m_data->frequency = Frequency
    (   statement.extract<int>(0),
        static_cast<IntervalType>(statement.extract<int>(1))
    );
    temp.m_data->next_date =
        numeric_cast<DateRep>(statement.extract<long long>(2));
    temp.m_data->journal_id = statement.extract<Id>(3);
    swap(temp);
    JEWEL_ASSERT
    (   is_valid_date_for_interval_type
        (   boost_date_from_julian_int(value(m_data->next_date)),
            value(m_data->frequency).step_type()
        )
    );
    return;
}
void
Repeater::process_saving_statement(SQLStatement& statement)
{
    Frequency const freq = value(m_data->frequency);
    JEWEL_ASSERT
    (   is_valid_date_for_interval_type
        (   boost_date_from_julian_int(value(m_data->next_date)),
            freq.step_type()
        )
    );
    statement.bind(":interval_units", freq.num_steps());
    statement.bind
    (   ":interval_type_id",
        static_cast<int>(freq.step_type())
    );
    statement.bind(":next_date", value(m_data->next_date));
    statement.bind(":journal_id", value(m_data->journal_id));
    statement.step_final();
    return;
}
void
Repeater::do_save_existing()
{
    SQLStatement updater
    (   database_connection(),
        "update repeaters set "
        "interval_units = :interval_units, "
        "interval_type_id = :interval_type_id, "
        "next_date = :next_date, "
        "journal_id = :journal_id "
        "where repeater_id = :repeater_id"
    );
    updater.bind(":repeater_id", id());
    process_saving_statement(updater);
    return;
}