39 lines
533 B
C++
39 lines
533 B
C++
#ifndef PGSQL_COL_H
|
|
#define PGSQL_COL_H
|
|
|
|
#include "Pgsql_Row.h"
|
|
|
|
namespace Pgsql {
|
|
|
|
class Col {
|
|
public:
|
|
explicit Col(Pgsql::Row &r)
|
|
: row(r)
|
|
{}
|
|
|
|
void reset() { col = -1; }
|
|
Pgsql::Value nextValue()
|
|
{
|
|
return row.get(++col);
|
|
}
|
|
private:
|
|
Pgsql::Row &row;
|
|
int col = -1;
|
|
};
|
|
|
|
// template <typename T>
|
|
// void operator<<(T &s, Col &c)
|
|
// {
|
|
// s << c.nextValue();
|
|
// }
|
|
|
|
template <typename T>
|
|
Col& operator>>(Col &c, T &s)
|
|
{
|
|
s << c.nextValue();
|
|
return c;
|
|
}
|
|
|
|
} // end namespace Pgsql
|
|
|
|
#endif // PGSQL_COL_H
|