コード例 #1
0
ファイル: sql_driver.cpp プロジェクト: CarverLab/yb-orm
RowPtr
SqlCursor::fetch_row()
{
    try {
        RowPtr row = backend_->fetch_row();
        if (row.get()) {
            Row::iterator j = row->begin(), jend = row->end();
            for (; j != jend; ++j) {
                String uname = str_to_upper(j->first);
                using namespace std;
                swap(j->first, uname);
            }
        }
        if (echo_) {
            if (row.get()) {
                std::ostringstream out;
                out << "fetch: ";
                Row::const_iterator j = row->begin(),
                                    jend = row->end();
                for (; j != jend; ++j)
                    out << NARROW(j->first) << "="
                        << NARROW(j->second.sql_str()) << " ";
                debug(WIDEN(out.str()));
            }
            else
                debug(_T("fetch: no more rows"));
        }
        return row;
    }
    catch (const std::exception &e) {
        connection_.mark_bad(e);
        throw;
    }
}
コード例 #2
0
ファイル: engine.cpp プロジェクト: sunfirefox/yb-orm
const Value
EngineBase::select1(const Expression &what,
        const Expression &from, const Expression &where)
{
    RowPtr row = select_row(what, from, where);
    if (row->size() != 1)
        throw BadSQLOperation(_T("Unable to fetch exactly one column!"));
    return row->begin()->second;
}