On Fri, Oct 30, 2009 at 08:44:52PM +0900, Hitoshi Harada wrote:
> So, by chance, I have been working on plv8 for my own purpose and
> query like below is done:
>
> regression=# CREATE OR REPLACE FUNCTION plv8_test(keys text[], vals
> text[]) RETURNS text AS $$
> var o = {};
> for(var i=0; i<keys.length; i++){
> o[keys[i]] = vals[i];
> }
> return JSON.stringify(o);
> $$ LANGUAGE plv8 IMMUTABLE STRICT;
> CREATE FUNCTION
>
> regression=# SELECT plv8_test(ARRAY['name', 'age'], ARRAY['Tom', '29']);
> plv8_test
> ---------------------------
> {"name":"Tom","age":"29"}
> (1 row)
>
> There are still too many TODOs such like type conversion between JS
> and SQL, build system, and memory allocation. If you want I'll send
> you my code.
Please send a patch! :) :) :)
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate