// Authors:
// Tim Coleman <tim@timcoleman.com>
// Daniel Moragn <danielmorgan@verizon.net>
+// Hubert FONGARNAND <informatique.internet@fiducial.fr>
//
// Copyright (C) Tim Coleman , 2003
// Copyright (C) Daniel Morgan, 2005
+// Copyright (C) Hubert FONGARNAND, 2005
//
// Licensed under the MIT/X11 License.
//
#region Constructors
- // constructor for cloning the object\r
- internal OracleParameter (OracleParameter value) {\r
- this.name = value.name;\r
- this.oracleType = value.oracleType;\r
- this.ociType = value.ociType;\r
- this.size = value.size;\r
- this.direction = value.direction;\r
- this.isNullable = value.isNullable;\r
- this.precision = value.precision;\r
- this.scale = value.scale;\r
- this.srcColumn = value.srcColumn;\r
- this.srcVersion = value.srcVersion;\r
- this.dbType = value.dbType;\r
- this.offset = value.offset;\r
- this.sizeSet = value.sizeSet;\r
- this.value = value.value;\r
- this.lobLocator = value.lobLocator;\r
+ // constructor for cloning the object
+ internal OracleParameter (OracleParameter value) {
+ this.name = value.name;
+ this.oracleType = value.oracleType;
+ this.ociType = value.ociType;
+ this.size = value.size;
+ this.direction = value.direction;
+ this.isNullable = value.isNullable;
+ this.precision = value.precision;
+ this.scale = value.scale;
+ this.srcColumn = value.srcColumn;
+ this.srcVersion = value.srcVersion;
+ this.dbType = value.dbType;
+ this.offset = value.offset;
+ this.sizeSet = value.sizeSet;
+ this.value = value.value;
+ this.lobLocator = value.lobLocator;
}
public OracleParameter ()
else
throw new NotImplementedException (); // ?
- sDate = dt.ToString (sysDateFormat);
- rsize = 0;
-
- // Get size of buffer
- OciCalls.OCIUnicodeToCharSet (statement.Parent, null, sDate, out rsize);
-
- // Fill buffer
- bytes = new byte[rsize];
- OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, sDate, out rsize);
-
- bindType = OciDataType.VarChar2;
- //bindValue = Marshal.StringToHGlobalAnsi (sDate);
- bindSize = sDate.Length;
+ bytes = PackDate (dt);
+ bindType = OciDataType.Date;
+ bindSize = bytes.Length;
}
else if (oracleType == OracleType.Blob) {
bytes = (byte[]) v;
bindType = OciDataType.Long;
bindSize = bytes.Length;
}
- else if (oracleType == OracleType.Raw) {\r
- byte[] val = v as byte[];\r
- bindValue = Marshal.AllocHGlobal (val.Length);\r
- Marshal.Copy (val, 0, bindValue, val.Length);\r
- bindSize = val.Length;\r
+ else if (oracleType == OracleType.Raw) {
+ byte[] val = v as byte[];
+ bindValue = Marshal.AllocHGlobal (val.Length);
+ Marshal.Copy (val, 0, bindValue, val.Length);
+ bindSize = val.Length;
}
else {
string svalue = v.ToString ();
}
+ internal byte[] PackDate (DateTime dateValue)
+ {
+ byte[] buffer = new byte[7];
+
+ buffer[0] = (byte)((dateValue.Year / 100) + 100); //century
+ buffer[1] = (byte)((dateValue.Year % 100) + 100); // Year
+ buffer[2] = (byte)dateValue.Month;
+ buffer[3] = (byte)dateValue.Day;
+ buffer[4] = (byte)(dateValue.Hour+1);
+ buffer[5] = (byte)(dateValue.Minute+1);
+ buffer[6] = (byte)(dateValue.Second+1);
+
+ return buffer;
+ }
+
#endregion // Methods
internal sealed class OracleParameterConverter : ExpandableObjectConverter