Exemplo n.º 1
0
/// Binds a test result type to a statement parameter.
///
/// \param stmt The statement to which to bind the parameter.
/// \param field The name of the parameter; must exist.
/// \param type The result type to bind.
void
store::bind_test_result_type(sqlite::statement& stmt, const char* field,
                             const model::test_result_type& type)
{
    switch (type) {
    case model::test_result_broken:
        stmt.bind(field, "broken");
        break;

    case model::test_result_expected_failure:
        stmt.bind(field, "expected_failure");
        break;

    case model::test_result_failed:
        stmt.bind(field, "failed");
        break;

    case model::test_result_passed:
        stmt.bind(field, "passed");
        break;

    case model::test_result_skipped:
        stmt.bind(field, "skipped");
        break;

    default:
        UNREACHABLE;
    }
}
Exemplo n.º 2
0
/// Binds a string to a statement parameter.
///
/// If the string is not empty, this binds the string itself.  Otherwise, it
/// binds a NULL value.
///
/// \param stmt The statement to which to bind the parameter.
/// \param stmt The statement to which to bind the field.
/// \param field The name of the parameter; must exist.
/// \param str The string to bind.
void
store::bind_optional_string(sqlite::statement& stmt, const char* field,
                            const std::string& str)
{
    if (str.empty())
        stmt.bind(field, sqlite::null());
    else
        stmt.bind(field, str);
}
Exemplo n.º 3
0
/// Binds a boolean value to a statement parameter.
///
/// \param stmt The statement to which to bind the parameter.
/// \param field The name of the parameter; must exist.
/// \param value The value to bind.
void
store::bind_bool(sqlite::statement& stmt, const char* field, const bool value)
{
    stmt.bind(field, value ? "true" : "false");
}
Exemplo n.º 4
0
/// Binds a time delta to a statement parameter.
///
/// \param stmt The statement to which to bind the parameter.
/// \param field The name of the parameter; must exist.
/// \param delta The value to bind.
void
store::bind_delta(sqlite::statement& stmt, const char* field,
                  const datetime::delta& delta)
{
    stmt.bind(field, static_cast< int64_t >(delta.to_microseconds()));
}
Exemplo n.º 5
0
/// Binds a timestamp to a statement parameter.
///
/// \param stmt The statement to which to bind the parameter.
/// \param field The name of the parameter; must exist.
/// \param timestamp The value to bind.
void
store::bind_timestamp(sqlite::statement& stmt, const char* field,
                      const datetime::timestamp& timestamp)
{
    stmt.bind(field, timestamp.to_microseconds());
}