Re: C++, Postgres , libpqxx huge query

Поиск
Список
Период
Сортировка
От alexandros_e
Тема Re: C++, Postgres , libpqxx huge query
Дата
Msg-id 1399259068714-5802392.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: C++, Postgres , libpqxx huge query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
To answer my own question, I adapted How to use pqxx::stateless_cursor class
from libpqxx?

try {
        work W(*Conn);
        pqxx::stateless_cursor<pqxx::cursor_base::read_only,
pqxx::cursor_base::owned>
                cursor(W, sql[sqlLoad], "mycursor", false);
        /* Assume you know total number of records returned */
        for (size_t idx = 0; idx < countRecords; idx += 100000) {
            /* Fetch 100,000 records at a time */
            result r = cursor.retrieve(idx, idx + 100000);
            for (int rownum = 0; rownum < r.size(); ++rownum) {
                const result::tuple row = r[rownum];
                vid1 = row[0].as<int>();
                vid2 = row[1].as<int>();
                vid3 = row[2].as<int>();
                .............
            }
        }
    } catch (const std::exception &e) {
        std::cerr << e.what() << std::endl;
    }





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/C-Postgres-libpqxx-huge-query-tp5802330p5802392.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: monitoring postgresql with Munin
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Monitoring Pg servers with Microsoft SCOM