Using refcursors in application code (php, python, whatever...)

Поиск
Список
Период
Сортировка
От Webb Sprague
Тема Using refcursors in application code (php, python, whatever...)
Дата
Msg-id b11ea23c0811120712v7c102ee2q543a7c9d45df2487@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
Hi all,

Does anyone have any advice on using application code with a
refcursor? This is a follow up to my "is there a safe-ish way to
execute arbitrary sql" ?  Now that I have way to execute my arbitrary
sql, I need to generate an html table with the arbitrary result inside
some PHP (or whatever), so I need to loop over the results of the
cursor (or do some weird return setof magic which I just figured out).

Sorry to ask here, but I think it is more likely that the readers will
even know what a refcursor is than on a massive php email list.

Here is what I have working in psql:

select query_table_data('select * from mkn_data.datatable_00013', 'boobear');

 query_table_data
------------------
 boobear
(1 row)

mkn=# FETCH FORWARD ALL FROM boobear;
 col1  | col2
-------+------
 bob   |   34
 alice |   32
(2 rows)

Now I need something that says

$curs.fetchall()

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

Предыдущее
От: "Grzegorz Jaśkiewicz"
Дата:
Сообщение: Re: sort_mem param of postgresql.conf
Следующее
От: Jack Orenstein
Дата:
Сообщение: Table bloat and vacuum