예제 #1
0
파일: dbtypes.cpp 프로젝트: namore/kyua
/// 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;
    }
}
예제 #2
0
파일: dbtypes.cpp 프로젝트: namore/kyua
/// 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);
}
예제 #3
0
파일: dbtypes.cpp 프로젝트: namore/kyua
/// 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");
}
예제 #4
0
파일: dbtypes.cpp 프로젝트: namore/kyua
/// 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()));
}
예제 #5
0
파일: dbtypes.cpp 프로젝트: namore/kyua
/// 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());
}