示例#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());
}