I'm reviewing dotConnect for Oracle to replace ODP.NET.
I've encountered a strange problem with stored proc parameters, when the name of the parameter ends with a $-sign.
When we call a stored procedure, we cache the parameters for subsequent calls. Below is an example of this:
Code: Select all
public ArrayList ExecuteOutputValues(string commandText, params object[] parameterValues)
{
OracleParameter[] commandParameters = getParameterSet(commandText);
AssignParameterValues(commandParameters, parameterValues, false);
using (OracleCommand cmd = new OracleCommand())
{
PrepareCommand(cmd, CommandType.StoredProcedure, commandText, commandParameters);
cmd.ExecuteNonQuery();
ArrayList outputValues = new ArrayList();
foreach (OracleParameter p in commandParameters)
{
if (p.Direction == ParameterDirection.InputOutput || p.Direction == ParameterDirection.Output)
{
if (p.Value is DBNull)
outputValues.Add(null);
else
outputValues.Add(p.Value);
}
}
return outputValues;
}
}
AssignParameterValues assigns input values to the parameters.
In Preparecommand, the parameters are assigned to the command object.
The command is then executed.
The next line is important:
Code: Select all
foreach (OracleParameter p in commandParameters)
cmd.Parameters[0] == commandParameters[0], etc.
But when at least one of the storec proc parameters ends with a '$-sign',
it seems as if cmd.Parameters is cleared, and replaced with a new set of parameters. As a consequence cmd.Parameters[0] != commandParameters[0], etc. I must add to this that the problem goes away if I set cmd.ParameterCheck = true;
Can you please look into this?
Thanks,
Marc