Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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()

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux