SCM

[#1010936] prepared stmt with out direction not working

View Trackers | Bugs | Download .csv | Monitor

Date:
2010-10-24 02:48
Priority:
3
State:
Open
Submitted by:
Mark B (matchbox52)
Assigned to:
Nobody (None)
Npgsql Version:
None
Category:
Group:
Resolution:
None
Summary:
prepared stmt with out direction not working

Detailed description
Having a problem using an out directive with a stored procedure when prepared, and its been suggested it might be a bug.

I have tried NPGsql 2.0.8 and 2.0.10 and not managed to get it to work. It seems that when unprepared, it only sends the in direction parameter bindings, when when it's prepared it seems to send them all.

-----------------------------------------------------

CREATE OR REPLACE FUNCTION dvapp.spbdaddition(IN inrunid integer, IN inxid integer, OUT outbdident integer)

-------------------

cmd.CommandType = CommandType.StoredProcedure;
paramRunID = new NpgsqlParameter("@inRunID", NpgsqlDbType.Integer);
paramXValue = new NpgsqlParameter("@inXID", NpgsqlDbType.Integer);
paramBDID = new NpgsqlParameter("@outBDIdent", NpgsqlDbType.Integer);
paramBDID.Direction = ParameterDirection.Output;
cmd.Parameters.Add(paramRunID);
cmd.Parameters.Add(paramXValue);
cmd.Parameters.Add(paramBDID);
cmd.prepare
..
paramRunID.NpgsqlValue = nRunID;
paramXValue.NpgsqlValue = nXID;
cmd.ExecuteNonQuery();
int nBDID = Convert.ToInt32(cmd.Parameters["@outIDIdent"].NpgsqlValue);

=============================================
cmd.CommandText = "spbdaddition(@inRunID, @inXID)";
..
//cmd.Prepare();

RUNS, from network get decrypted app data fragment: Q^@^@^@@select * from spBDAddition(((118)::int4), ((47)::int4))^@
and result is in @outIDIdent
----------------------------------------------
cmd.CommandText = "spbdaddition(@inRunID, @inXID)"
..
cmd.Prepare();

2010-10-20 00:14:01 PDT [28095]: [238-1] ERROR: bind message supplies 3 parameters, but prepared statement "npgsqlplan5" requires 2
2010-10-20 00:14:01 PDT [28095]: [239-1] STATEMENT: select * from spbdaddition($1::int4, $2::int4)
from network get decrypted app data fragment: B^@^@^@0^@npgsqlplan5^@^@^C^@^@^@^@^@^@^@^C^@^@^@^C120^@^@^@^B39<FF><FF><FF><FF>^@^A^@^@H^@^@^@^D
----------------------------------------------
Tried this, just too see,
cmd.CommandText = "spbdaddition(@inRunID, @inXID, @outBDIdent)";
..
cmd.Prepare();

Failed! ERROR: 42703: column "outbdident" does not exist -- at Npgsql.NpgsqlState.<ProcessBackendResponses_Ver_3>d__a.MoveNext()
2010-10-20 01:09:27 PDT [28556]: [7-1] ERROR: column "outbdident" does not exist at character 53
2010-10-20 01:09:27 PDT [28556]: [8-1] STATEMENT: select * from spbdaddition($1::int4, $2::int4, @outBDIdent)



Followup

No Followups Have Been Posted

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge