From: thomas at tada.se (Thomas Hallgren) Date: Fri, 17 Mar 2006 09:01:07 +0100 Subject: [Pljava-dev] Fw: out of memery In-Reply-To: <20060317044756.BF2C6196150@smtp.263.net> References: <20060317044756.BF2C6196150@smtp.263.net> Message-ID: <441A6CC3.4030401@tada.se> Hi Lifeng The postgresql backend will issue a call to the Java language handler. One call per retrieved row. The first call will issue a call to your static method, take the ResultSet that is returned, wrap it in a org.postgresql.pljava.internal.ResultSetPicker and then issue a call to assignRowValues() on that wrapper. That method in turn will issue a call to next() on your ResultSet. Data from the ResultSet is then copied over to a tuple. Now the function returns. Subsequent calls from pgsql to get the remaining rows will now call the assignRowValuues() that in turn will call next() on your result set. This will happen, one row at a time, until your ResultSet returns false on a call to next() or until the query is interrupted. For more info, see: http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html. Especially the section titled "32.9.10. Returning Sets from C-Language Functions". Relevant parts of the PL/Java source code can be found in: src/C/pljava/Backend.c src/C/pljava/Function.c src/C/pljava/type/ResultSetProvider.c src/java/pljava/org/postgresql/pljava/ResultSetHandle.java src/java/pljava/org/postgresql/pljava/internal/ResultSetPicker.java Hope this helps, - thomas lifeng wrote: > , ??? > > Can you tell me how the pgsql use the ResultSetHandler through the function mechanism and which apis are used by pgsql. > thank you very much. > >