Hi,
I have a function in postgresql v. 8.2.6 like this
CREATE OR REPLACE FUNCTION testcursore(refcursor)
RETURNS refcursor AS
$BODY$
begin
OPEN $1 FOR EXECUTE 'SELECT * FROM mytable';
return $1;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION testcursore(refcursor) OWNER TO postgres;
that returns a dinamic cursor.
my table is something like
CREATE TABLE mytable
(
id serial NOT NULL,
dex character varying(30) NOT NULL
)
The generated code (see below) has errors in class RetrievalProcedures.cs at lines
10 (misses comma between parameters)
19 (misses comma between parameters)
22 (misses parameter creation)
Adding the missing commas and something like
parameters[0]=new NpgsqlParameter("param4", NpgsqlDbType.Refcursor, 0, "", ParameterDirection.Input, true, 0, 0, DataRowVersion.Current, param4) on line 22
everything works fine.
Third function at line 32 is ok.
LlblGenPro v.2.6 October 6th, 2008, framework 2.0 as target platform.
Can You help?
Thanks in advance
1 /// <summary>
2 /// Calls stored procedure 'testcursore'.<br/><br/>
3 ///
4 /// </summary>
5 /// <returns>Filled DataSet with resultset(s) of stored procedure</returns>
6 public static DataSet Testcursore(System.Object param4)
7 {
8 using(DataAccessAdapter adapter = new DataAccessAdapter())
9 {
10 return Testcursore(param4 adapter);
11 }
12 }
13 /// <summary>
14 /// Calls stored procedure 'testcursore'.<br/><br/>
15 ///
16 /// </summary>
17 /// <param name="adapter">The DataAccessAdapter object to use for the call</param>
18 /// <returns>Filled DataSet with resultset(s) of stored procedure</returns>
19 public static DataSet Testcursore(System.Object param4DataAccessAdapter adapter)
20 {
21 NpgsqlParameter[] parameters = new NpgsqlParameter[1];
22
23 DataSet toReturn = new DataSet("Testcursore");
24 bool hasSucceeded = adapter.CallRetrievalStoredProcedure("public.testcursore", parameters, toReturn);
25 return toReturn;
26 }
27 /// <summary>Creates an IRetrievalQuery object for a call to the procedure 'testcursore'.
28 ///
29 /// </summary>
30 /// <param name="param4">Input parameter of stored procedure</param>
31 /// <returns>IRetrievalQuery object which is ready to use for datafetching</returns>
32 public static IRetrievalQuery GetTestcursoreCallAsQuery(System.Object param4)
33 {
34 RetrievalQuery toReturn = new RetrievalQuery( new NpgsqlCommand("public.testcursore" ) );
35 toReturn.Parameters.Add(new NpgsqlParameter("param4", NpgsqlDbType.Refcursor, 0, "", ParameterDirection.Input, true, 0, 0, DataRowVersion.Current, param4));
36
37 toReturn.Command.CommandType = CommandType.StoredProcedure;
38 return toReturn;
39 }