blob: 03301e3d70122d6ece26c316a073217931dbd22a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "pq-selectbase.h"
#include "command.h"
#include "pq-binarycolumn.h"
#include "pq-column.h"
#include "pq-command.h"
#include <libpq-fe.h>
#include <memory>
#include <ranges>
#include <selectcommand.h>
#include <string>
PQ::SelectBase::SelectBase(const std::string & sql, const PQ::CommandOptionsCPtr & pqco) :
DB::Command(sql), DB::SelectCommand(sql), nTuples(0), tuple(0), binary(pqco ? pqco->fetchBinary : false)
{
}
void
PQ::SelectBase::createColumns()
{
for (int field : std::views::iota(0, PQnfields(execRes.get()))) {
if (binary) {
insertColumn(std::make_unique<BinaryColumn>(this, field));
}
else {
insertColumn(std::make_unique<Column>(this, field));
}
}
}
|