postgresql - store function output in an array -
i have follwoing function works fine, not sure if storing in array.
declare _r record; point character varying[] := '{}'; int := 0; begin _r in execute ' select a.'|| quote_ident(column_name) || ' point ' || quote_ident (table_name) ||' a' loop point[i] = _r; = i+1; end loop; homecoming point; end; what after have array javascript side can traverse , read each value stored on array. right way of doing it?
arrays in pl/pgsql or postgresql has nil arrays in javascript or php.
if you're working libpq-aware client, php, query databases homecoming set of records, can accumulated internal array variable of calling party, pg_fetch_array() of php.
if you're working lean clients, javascript is, need homecoming info in format suitable javascript understand. need have server-side info providing service, obtain results postgresql via libpq native interface , convert javascript-ready one, json. postgresql has native back upwards xml info type , json (a bit limited @ moment). not sure if help much though.
as pl/pgsql functions, recommend reading official docs on language. in order see value of point @ runtime, utilize statement:
raise notice 'point = %', point; postgresql plpgsql libpq
No comments:
Post a Comment