diff options
author | Neale <neale@sinenomine.net> | 2013-04-17 06:48:58 +0400 |
---|---|---|
committer | Neale <neale@sinenomine.net> | 2013-04-17 06:48:58 +0400 |
commit | 66c4520fa2e7890b3ccf26f3999c5bc94dd19e27 (patch) | |
tree | 1a7bd79c333d697502008d7598b2c27342afe1d8 /mcs/class | |
parent | 777336db719cb50119d7011af6f79d3f6b8135c9 (diff) |
Correct marshalling of size variables used in CharSetToUnicode (and vice-versa). They were specified as integers but for these calls they are, in C parlance, size_t so use SysUInt instead.
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs | 14 | ||||
-rw-r--r-- | mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs index b73a01bafe5..743a3c72ed8 100644 --- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs +++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs @@ -461,19 +461,19 @@ namespace System.Data.OracleClient.Oci internal static extern int OCICharSetToUnicode ( IntPtr svchp, [MarshalAs (UnmanagedType.LPWStr)] StringBuilder dst, - [MarshalAs (UnmanagedType.U4)] int dstlen, + [MarshalAs (UnmanagedType.SysUInt)] int dstlen, byte [] src, - [MarshalAs (UnmanagedType.U4)] int srclen, - [MarshalAs (UnmanagedType.U4)] out int rsize); + [MarshalAs (UnmanagedType.SysUInt)] int srclen, + [MarshalAs (UnmanagedType.SysUInt)] out int rsize); [DllImport ("oci")] internal static extern int OCIUnicodeToCharSet ( IntPtr svchp, byte [] dst, - [MarshalAs (UnmanagedType.U4)] int dstlen, + [MarshalAs (UnmanagedType.SysUInt)] int dstlen, [MarshalAs (UnmanagedType.LPWStr)] string src, - [MarshalAs (UnmanagedType.U4)] int srclen, - [MarshalAs (UnmanagedType.U4)] out int rsize); + [MarshalAs (UnmanagedType.SysUInt)] int srclen, + [MarshalAs (UnmanagedType.SysUInt)] out int rsize); } #endregion @@ -1196,7 +1196,7 @@ namespace System.Data.OracleClient.Oci IntPtr svchp, byte [] dst, [MarshalAs (UnmanagedType.LPWStr)] string src, - [MarshalAs (UnmanagedType.U4)] out int rsize) + [MarshalAs (UnmanagedType.SysUInt)] out int rsize) { #if TRACE Trace.WriteLineIf(traceOci, "OCIUnicodeToCharSet", "OCI"); diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs index c5973ff2712..df17716097d 100644 --- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs +++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs @@ -1116,8 +1116,14 @@ namespace System.Data.OracleClient private void SetOracleType (OracleType type, bool inferring) { + Type valType; FreeHandle (); - Type valType = value.GetType (); + + if (value == null) + valType = typeof(System.DBNull); + else + valType = value.GetType (); + string exception = String.Format ("No mapping exists from OracleType {0} to a known DbType.", type); switch (type) { case OracleType.BFile: |