2017-12-09 10:45:13 +01:00
|
|
|
|
#ifndef PGSQL_COL_H
|
|
|
|
|
|
#define PGSQL_COL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "Pgsql_Row.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Pgsql {
|
|
|
|
|
|
|
|
|
|
|
|
class Col {
|
|
|
|
|
|
public:
|
2017-12-12 20:13:53 +01:00
|
|
|
|
explicit Col(const Pgsql::Row &r)
|
2017-12-09 10:45:13 +01:00
|
|
|
|
: row(r)
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void reset() { col = -1; }
|
|
|
|
|
|
Pgsql::Value nextValue()
|
|
|
|
|
|
{
|
|
|
|
|
|
return row.get(++col);
|
|
|
|
|
|
}
|
|
|
|
|
|
private:
|
2017-12-12 20:13:53 +01:00
|
|
|
|
const Pgsql::Row &row;
|
2017-12-09 10:45:13 +01:00
|
|
|
|
int col = -1;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
|
Col& operator>>(Col &c, T &s)
|
|
|
|
|
|
{
|
|
|
|
|
|
s << c.nextValue();
|
|
|
|
|
|
return c;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace Pgsql
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PGSQL_COL_H
|