Exemple #1
0
/// Formats a row of a statement for output as CSV.
///
/// \param stmt The statement whose current row to format.
///
/// \return A comma-separated list of values.
std::string
cli::format_row(sqlite::statement& stmt)
{
    std::string output;
    int i = 0;
    for (; i < stmt.column_count() - 1; ++i)
        output += cli::format_cell(stmt, i) + ',';
    output += cli::format_cell(stmt, i);
    return output;
}
Exemple #2
0
/// Formats the column names of a statement for output as CSV.
///
/// \param stmt The statement whose columns to format.
///
/// \return A comma-separated list of column names.
std::string
cli::format_headers(sqlite::statement& stmt)
{
    std::string output;
    int i = 0;
    for (; i < stmt.column_count() - 1; ++i)
        output += stmt.column_name(i) + ',';
    output += stmt.column_name(i);
    return output;
}