IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U4)] OciDataType dty,
- ref short indp,
- ref short rlenp,
+ IntPtr indp,
+ IntPtr rlenp,
IntPtr rcodep,
uint mode);
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U4)] OciDataType dty,
- ref short indp,
- ref short rlenp,
+ IntPtr indp,
+ IntPtr rlenp,
IntPtr rcodep,
uint mode);
IntPtr valuep,
int value_sz,
OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByName (stmtp, out bindpp, errhp, placeholder, placeh_len, valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByNameRef (IntPtr stmtp,
ref IntPtr valuep,
int value_sz,
OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByNameRef (stmtp, out bindpp, errhp, placeholder, placeh_len, ref valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByNameBytes (IntPtr stmtp,
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByNameBytes (stmtp, out bindpp, errhp, placeholder, placeh_len, valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPos (IntPtr stmtp,
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPos (stmtp, out bindpp, errhp, position, valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPosRef (IntPtr stmtp,
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPosRef (stmtp, out bindpp, errhp, position, ref valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPosBytes (IntPtr stmtp,
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
+ IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPosBytes (stmtp, out bindpp, errhp, position, valuep,
- value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
[DllImport ("oci")]
IntPtr valuep,
int value_sz,
OciDataType dty,
- ref short indp,
- ref short rlenp,
+ IntPtr indp,
+ IntPtr rlenp,
IntPtr rcodep,
uint mode)
{
Trace.WriteLineIf(traceOci, "OCIDefineByPos", "OCI");
#endif
return OciNativeCalls.OCIDefineByPos (stmtp, out defnpp, errhp, position, valuep,
- value_sz, dty, ref indp, ref rlenp, rcodep, mode);
+ value_sz, dty, indp, rlenp, rcodep, mode);
}
internal static int OCIDefineByPosPtr (IntPtr stmtp,
ref IntPtr valuep,
int value_sz,
OciDataType dty,
- ref short indp,
- ref short rlenp,
+ IntPtr indp,
+ IntPtr rlenp,
IntPtr rcodep,
uint mode)
{
Trace.WriteLineIf(traceOci, "OCIDefineByPosPtr", "OCI");
#endif
return OciNativeCalls.OCIDefineByPosPtr (stmtp, out defnpp, errhp, position, ref valuep,
- value_sz, dty, ref indp, ref rlenp, rcodep, mode);
+ value_sz, dty, indp, rlenp, rcodep, mode);
}
internal static int OCIDescriptorFree (IntPtr hndlp,
//IntPtr handle;
IntPtr value;
- short indicator;
+ IntPtr indicator;
//OracleType type;
OciDataType ociType;
OciDataType definedType;
int definedSize;
- short rlenp = 0;
+ IntPtr rlenp;
//short precision;
short scale;
Type fieldType;
- //string name;
+ string name;
// Oracle defines the LONG VARCHAR and LONG VARRAW to have a size of 2 to the 31 power - 5
// see DefineLongVarChar and DefineLongVarRaw
{
OciParameterDescriptor parameter = ((OciStatementHandle) Parent).GetParameter (position);
- //name = parameter.GetName ();
+ name = parameter.GetName ();
definedType = parameter.GetDataType ();
definedSize = parameter.GetDataSize ();
//precision = parameter.GetPrecision ();
scale = parameter.GetScale ();
+ rlenp = OciCalls.AllocateClear (sizeof(short));
+ indicator = OciCalls.AllocateClear (sizeof(short));
Define (position, connection);
}
internal bool IsNull {
- get { return (indicator == -1); }
+ get { return (Indicator == -1); }
}
internal short Scale {
}
internal short Size {
- get { return rlenp; }
+ get { return(Marshal.ReadInt16(rlenp)); }
+ set { Marshal.WriteInt16(rlenp, value); }
+ }
+
+ internal short Indicator {
+ get { return(Marshal.ReadInt16(indicator)); }
+ set { Marshal.WriteInt16(indicator, value); }
}
internal IntPtr Value {
ref value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero, 0);
- rlenp = (short) definedSize;
+ Size = (short) definedSize;
if (status != 0) {
OciErrorInfo info = ErrorHandle.HandleError ();
value,
maxByteCount,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
OciErrorHandle.ThrowExceptionIfError (ErrorHandle, status);
ErrorHandle,
position + 1,
value,
- definedSize * 2,
+ definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
ref value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero, 0);
if (status != 0) {
value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero, 0);
if (status != 0) {
ref value,
definedSize,
ociType,
- ref indicator,
- ref rlenp,
+ indicator,
+ rlenp,
IntPtr.Zero,
0);
}
disposed = true;
} finally {
+ Marshal.FreeHGlobal (indicator);
+ Marshal.FreeHGlobal (rlenp);
base.Dispose (disposing);
value = IntPtr.Zero;
}
namespace System.Data.OracleClient
{
[TypeConverter (typeof(OracleParameter.OracleParameterConverter))]
- public sealed class OracleParameter :
+ public sealed class OracleParameter :
#if NET_2_0
- DbParameter, IDbDataParameter, ICloneable
+ DbParameter, IDbDataParameter, ICloneable,
#else
- MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable,
#endif
+ IDisposable
{
#region Fields
object value = DBNull.Value;
OciLobLocator lobLocator; // only if Blob or Clob
IntPtr bindOutValue = IntPtr.Zero;
+ IntPtr indicator = IntPtr.Zero;
OciDateTimeDescriptor dateTimeDesc;
IntPtr cursor = IntPtr.Zero;
bool useRef;
OciDataType bindType;
- short indicator;
int bindSize;
bool sizeManuallySet;
this.value = value.value;
this.lobLocator = value.lobLocator;
this.oracleTypeSet = value.oracleTypeSet;
+ this.indicator = OciCalls.AllocateClear (sizeof(short));
}
public OracleParameter ()
this.srcVersion = DataRowVersion.Current;
this.value = null;
this.oracleTypeSet = false;
+ this.indicator = OciCalls.AllocateClear (sizeof(short));
}
public OracleParameter (string name, object value)
srcColumn = string.Empty;
SourceVersion = DataRowVersion.Current;
InferOracleType (value);
+ this.indicator = OciCalls.AllocateClear (sizeof(short));
#if NET_2_0
// Find the OciType before inferring for the size
if (value != null && value != DBNull.Value) {
OracleType = oracleType;
SourceColumn = sourceColumn;
SourceVersion = sourceVersion;
+ this.indicator = OciCalls.AllocateClear (sizeof(short));
}
#endif
OracleType = oracleType;
SourceColumn = srcColumn;
SourceVersion = srcVersion;
+ this.indicator = OciCalls.AllocateClear (sizeof(short));
+ }
+
+ ~OracleParameter ()
+ {
+ Dispose(false);
}
#endregion // Constructors
set { container = value; }
}
+ internal short Indicator {
+ get { return (Marshal.ReadInt16(indicator)); }
+ set { Marshal.WriteInt16(indicator, value); }
+ }
+
#if !NET_2_0
[Browsable (false)]
[RefreshProperties (RefreshProperties.All)]
}
if (isnull == true && direction == ParameterDirection.Input) {
- indicator = 0;
bindType = OciDataType.VarChar2;
bindSize = 0;
} else {
case OciDataType.CharZ:
case OciDataType.OciString:
bindType = OciDataType.String;
- indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
dt = DateTime.MinValue;
sDate = "";
if (isnull)
- indicator = -1;
+ Indicator = -1;
else if (v is String) {
sDate = (string) v;
dt = DateTime.Parse (sDate);
case OciDataType.Float:
case OciDataType.Number:
bindType = OciDataType.String;
- indicator = 0;
+ Indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
bindSize = Size + 5; // 4 bytes prepended for length, bytes, 1 byte NUL character
- indicator = 0;
+ Indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
case OciDataType.VarRaw:
bindType = OciDataType.VarRaw;
bindSize = Size + 2; // include 2 bytes prepended to hold the length
- indicator = 0;
+ Indicator = 0;
bytes = new byte [bindSize];
if (direction == ParameterDirection.Input ||
direction == ParameterDirection.InputOutput) {
case OciDataType.LongVarRaw:
bindType = OciDataType.LongVarRaw;
bindSize = Size + 4; // include 4 bytes prepended to hold the length
- indicator = 0;
+ Indicator = 0;
bytes = new byte [bindSize];
if (direction == ParameterDirection.Input ||
direction == ParameterDirection.InputOutput) {
ref bindValue,
bindSize,
bindType,
- ref indicator,
+ indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
ref bindValue,
bindSize,
bindType,
- ref indicator,
+ indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
ref cursor,
bindSize,
bindType,
- ref indicator,
+ indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
bytes,
bindSize,
bindType,
- ref indicator,
+ indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
bindValue,
bindSize,
bindType,
- ref indicator,
+ indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
// used to update the parameter value
// for Output, the output of InputOutput, and Return parameters
value = DBNull.Value;
- if (indicator == -1)
+ if (Indicator == -1)
return;
int rsize = 0;
return buffer;
}
+ public void Dispose ()
+ {
+ Dispose (true);
+ }
+
+ void Dispose (bool disposing)
+ {
+ if (disposing) {
+ GC.SuppressFinalize(this);
+ }
+ if (indicator != IntPtr.Zero) {
+ Marshal.FreeHGlobal (indicator);
+ indicator = IntPtr.Zero;
+ }
+ }
+
#endregion // Methods
internal sealed class OracleParameterConverter : ExpandableObjectConverter