Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@@ -26,14 +26,14 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{F3E72F35-0351-4D67-2209-725BCAD807BA}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{7BAD100F-AD6B-490A-AF7C-8E3854E812C0}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{D589374B-3331-4660-8DFB-512D66F8EC63}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{D589374B-3331-4660-8DFB-512D66F8EC63}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{D589374B-3331-4660-8DFB-512D66F8EC63}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU

View File

@@ -1,3 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Data.Odbc
{
public sealed partial class OdbcCommand : System.Data.Common.DbCommand, System.ICloneable
@@ -198,7 +202,6 @@ namespace System.Data.Odbc
internal OdbcException() { }
public System.Data.Odbc.OdbcErrorCollection Errors { get { throw null; } }
public override string Source { get { throw null; } }
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))]
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
}
public sealed partial class OdbcFactory : System.Data.Common.DbProviderFactory

View File

@@ -1,12 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Data.Common
{
internal static class ExternDll
{
public const string Odbc32 = "libodbc.so.2";
}
}

View File

@@ -1,12 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Data.Common
{
internal static class ExternDll
{
public const string Odbc32 = "libodbc.2.dylib";
}
}

View File

@@ -1,11 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Data.Common
{
internal static class ExternDll
{
public const string Odbc32 = "odbc32.dll";
}
}

View File

@@ -1,4 +1,8 @@
using System.Runtime.InteropServices;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
namespace System.Data
{

View File

@@ -1,459 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Data.Odbc;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
namespace System.Data.Common
{
[SuppressUnmanagedCodeSecurity]
internal static partial class UnsafeNativeMethods
{
//
// ODBC32
//
[DllImport(ExternDll.Odbc32)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLAllocHandle(
/*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType,
/*SQLHANDLE*/IntPtr InputHandle,
/*SQLHANDLE* */out IntPtr OutputHandle);
[DllImport(ExternDll.Odbc32)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLAllocHandle(
/*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType,
/*SQLHANDLE*/OdbcHandle InputHandle,
/*SQLHANDLE* */out IntPtr OutputHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLBindCol(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/UInt16 ColumnNumber,
/*SQLSMALLINT*/ODBC32.SQL_C TargetType,
/*SQLPOINTER*/HandleRef TargetValue,
/*SQLLEN*/IntPtr BufferLength,
/*SQLLEN* */IntPtr StrLen_or_Ind);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLBindCol(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/UInt16 ColumnNumber,
/*SQLSMALLINT*/ODBC32.SQL_C TargetType,
/*SQLPOINTER*/IntPtr TargetValue,
/*SQLLEN*/IntPtr BufferLength,
/*SQLLEN* */IntPtr StrLen_or_Ind);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLBindParameter(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/UInt16 ParameterNumber,
/*SQLSMALLINT*/Int16 ParamDirection,
/*SQLSMALLINT*/ODBC32.SQL_C SQLCType,
/*SQLSMALLINT*/Int16 SQLType,
/*SQLULEN*/IntPtr cbColDef,
/*SQLSMALLINT*/IntPtr ibScale,
/*SQLPOINTER*/HandleRef rgbValue,
/*SQLLEN*/IntPtr BufferLength,
/*SQLLEN* */HandleRef StrLen_or_Ind);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLCancel(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLCloseCursor(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLColAttributeW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/Int16 ColumnNumber,
/*SQLUSMALLINT*/Int16 FieldIdentifier,
/*SQLPOINTER*/CNativeBuffer CharacterAttribute,
/*SQLSMALLINT*/Int16 BufferLength,
/*SQLSMALLINT* */out Int16 StringLength,
/*SQLPOINTER*/out IntPtr NumericAttribute);
// note: in sql.h this is defined differently for the 64Bit platform.
// However, for us the code is not different for SQLPOINTER or SQLLEN ...
// frome sql.h:
// #ifdef _WIN64
// SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle,
// SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
// SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
// SQLSMALLINT *StringLength, SQLLEN *NumericAttribute);
// #else
// SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle,
// SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
// SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
// SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute);
// #endif
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLColumnsW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableName,
/*SQLSMALLINT*/Int16 NameLen3,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string ColumnName,
/*SQLSMALLINT*/Int16 NameLen4);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLDisconnect(
/*SQLHDBC*/IntPtr ConnectionHandle);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLDriverConnectW(
/*SQLHDBC*/OdbcConnectionHandle hdbc,
/*SQLHWND*/IntPtr hwnd,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string connectionstring,
/*SQLSMALLINT*/Int16 cbConnectionstring,
/*SQLCHAR* */IntPtr connectionstringout,
/*SQLSMALLINT*/Int16 cbConnectionstringoutMax,
/*SQLSMALLINT* */out Int16 cbConnectionstringout,
/*SQLUSMALLINT*/Int16 fDriverCompletion);
[DllImport(ExternDll.Odbc32)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLEndTran(
/*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType,
/*SQLHANDLE*/IntPtr Handle,
/*SQLSMALLINT*/Int16 CompletionType);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLExecDirectW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string StatementText,
/*SQLINTEGER*/Int32 TextLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLExecute(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLFetch(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLFreeHandle(
/*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType,
/*SQLHSTMT*/IntPtr StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLFreeStmt(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/ODBC32.STMT Option);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetConnectAttrW(
/*SQLHBDC*/OdbcConnectionHandle ConnectionHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/byte[] Value,
/*SQLINTEGER*/Int32 BufferLength,
/*SQLINTEGER* */out Int32 StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetData(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/UInt16 ColumnNumber,
/*SQLSMALLINT*/ODBC32.SQL_C TargetType,
/*SQLPOINTER*/CNativeBuffer TargetValue,
/*SQLLEN*/IntPtr BufferLength, // sql.h differs from MSDN
/*SQLLEN* */out IntPtr StrLen_or_Ind);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetDescFieldW(
/*SQLHSTMT*/OdbcDescriptorHandle StatementHandle,
/*SQLUSMALLINT*/Int16 RecNumber,
/*SQLUSMALLINT*/ODBC32.SQL_DESC FieldIdentifier,
/*SQLPOINTER*/CNativeBuffer ValuePointer,
/*SQLINTEGER*/Int32 BufferLength,
/*SQLINTEGER* */out Int32 StringLength);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetDiagRecW(
/*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType,
/*SQLHANDLE*/OdbcHandle Handle,
/*SQLSMALLINT*/Int16 RecNumber,
/*SQLCHAR* */ StringBuilder rchState,
/*SQLINTEGER* */out Int32 NativeError,
/*SQLCHAR* */StringBuilder MessageText,
/*SQLSMALLINT*/Int16 BufferLength,
/*SQLSMALLINT* */out Int16 TextLength);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetDiagFieldW(
/*SQLSMALLINT*/ ODBC32.SQL_HANDLE HandleType,
/*SQLHANDLE*/ OdbcHandle Handle,
/*SQLSMALLINT*/ Int16 RecNumber,
/*SQLSMALLINT*/ Int16 DiagIdentifier,
[MarshalAs(UnmanagedType.LPWStr)]
/*SQLPOINTER*/ StringBuilder rchState,
/*SQLSMALLINT*/ Int16 BufferLength,
/*SQLSMALLINT* */ out Int16 StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetFunctions(
/*SQLHBDC*/OdbcConnectionHandle hdbc,
/*SQLUSMALLINT*/ODBC32.SQL_API fFunction,
/*SQLUSMALLINT* */out Int16 pfExists);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetInfoW(
/*SQLHBDC*/OdbcConnectionHandle hdbc,
/*SQLUSMALLINT*/ODBC32.SQL_INFO fInfoType,
/*SQLPOINTER*/byte[] rgbInfoValue,
/*SQLSMALLINT*/Int16 cbInfoValueMax,
/*SQLSMALLINT* */out Int16 pcbInfoValue);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetInfoW(
/*SQLHBDC*/OdbcConnectionHandle hdbc,
/*SQLUSMALLINT*/ODBC32.SQL_INFO fInfoType,
/*SQLPOINTER*/byte[] rgbInfoValue,
/*SQLSMALLINT*/Int16 cbInfoValueMax,
/*SQLSMALLINT* */IntPtr pcbInfoValue);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetStmtAttrW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/out IntPtr Value,
/*SQLINTEGER*/Int32 BufferLength,
/*SQLINTEGER*/out Int32 StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLGetTypeInfo(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLSMALLINT*/Int16 fSqlType);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLMoreResults(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLNumResultCols(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLSMALLINT* */out Int16 ColumnCount);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLPrepareW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string StatementText,
/*SQLINTEGER*/Int32 TextLength);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLPrimaryKeysW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */ string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableName,
/*SQLSMALLINT*/Int16 NameLen3);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLProcedureColumnsW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string ProcName,
/*SQLSMALLINT*/Int16 NameLen3,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string ColumnName,
/*SQLSMALLINT*/Int16 NameLen4);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLProceduresW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */ string ProcName,
/*SQLSMALLINT*/Int16 NameLen3);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLRowCount(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLLEN* */out IntPtr RowCount);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetConnectAttrW(
/*SQLHBDC*/OdbcConnectionHandle ConnectionHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/System.Transactions.IDtcTransaction Value,
/*SQLINTEGER*/Int32 StringLength);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetConnectAttrW(
/*SQLHBDC*/OdbcConnectionHandle ConnectionHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/string Value,
/*SQLINTEGER*/Int32 StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetConnectAttrW(
/*SQLHBDC*/OdbcConnectionHandle ConnectionHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/IntPtr Value,
/*SQLINTEGER*/Int32 StringLength);
[DllImport(ExternDll.Odbc32)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetConnectAttrW( // used only for AutoCommitOn
/*SQLHBDC*/IntPtr ConnectionHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/IntPtr Value,
/*SQLINTEGER*/Int32 StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetDescFieldW(
/*SQLHSTMT*/OdbcDescriptorHandle StatementHandle,
/*SQLSMALLINT*/Int16 ColumnNumber,
/*SQLSMALLINT*/ODBC32.SQL_DESC FieldIdentifier,
/*SQLPOINTER*/HandleRef CharacterAttribute,
/*SQLINTEGER*/Int32 BufferLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetDescFieldW(
/*SQLHSTMT*/OdbcDescriptorHandle StatementHandle,
/*SQLSMALLINT*/Int16 ColumnNumber,
/*SQLSMALLINT*/ODBC32.SQL_DESC FieldIdentifier,
/*SQLPOINTER*/IntPtr CharacterAttribute,
/*SQLINTEGER*/Int32 BufferLength);
[DllImport(ExternDll.Odbc32)]
// user can set SQL_ATTR_CONNECTION_POOLING attribute with envHandle = null, this attribute is process-level attribute
[ResourceExposure(ResourceScope.Process)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetEnvAttr(
/*SQLHENV*/OdbcEnvironmentHandle EnvironmentHandle,
/*SQLINTEGER*/ODBC32.SQL_ATTR Attribute,
/*SQLPOINTER*/IntPtr Value,
/*SQLINTEGER*/ODBC32.SQL_IS StringLength);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSetStmtAttrW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLINTEGER*/Int32 Attribute,
/*SQLPOINTER*/IntPtr Value,
/*SQLINTEGER*/Int32 StringLength);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLSpecialColumnsW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
/*SQLUSMALLINT*/ODBC32.SQL_SPECIALCOLS IdentifierType,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableName,
/*SQLSMALLINT*/Int16 NameLen3,
/*SQLUSMALLINT*/ODBC32.SQL_SCOPE Scope,
/*SQLUSMALLINT*/ ODBC32.SQL_NULLABILITY Nullable);
[DllImport(ExternDll.Odbc32, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLStatisticsW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableName,
/*SQLSMALLINT*/Int16 NameLen3,
/*SQLUSMALLINT*/Int16 Unique,
/*SQLUSMALLINT*/Int16 Reserved);
[DllImport(ExternDll.Odbc32)]
[ResourceExposure(ResourceScope.None)]
internal static extern /*SQLRETURN*/ODBC32.RetCode SQLTablesW(
/*SQLHSTMT*/OdbcStatementHandle StatementHandle,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string CatalogName,
/*SQLSMALLINT*/Int16 NameLen1,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string SchemaName,
/*SQLSMALLINT*/Int16 NameLen2,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableName,
/*SQLSMALLINT*/Int16 NameLen3,
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableType,
/*SQLSMALLINT*/Int16 NameLen4);
}
}

View File

@@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
<PackageConfigurations>
netcoreapp2.0-FreeBSD;
netcoreapp2.0-Linux;
netcoreapp2.0-OSX;
netcoreapp2.0-Windows_NT;
netfx-Windows_NT;
netstandard;
netstandard-Linux;
netstandard-OSX;
netstandard-Windows_NT;
</PackageConfigurations>
<BuildConfigurations>
$(PackageConfigurations)
netcoreapp-FreeBSD;
netcoreapp-Linux;
netcoreapp-OSX;
netcoreapp-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,98 @@
# Instructions on how to setup database
## In Fedora 24 container:
- `docker ps` shows _id of existing Fedora 24 container
- `docker exec -it _id /bin/sh`
- `dnf install findutils` need to install findutils for building corefx to add missing xargs
- `find / -name libsqlite3odbc.so` to be used in odbcinst.ini
- `odbcinst -j` to show version and location of ini files
- `ldconfig -p | grep sqlite`
- `ldconfig -p | grep odbc`
- `dnf list | grep unixODBC`
- `dnf install unixODBC.x86_64`
- `dnf install unixODBC-devel.x86_64`
- `dnf install sqliteodbc.x86_64`
## Notes on commands used in Debian 8.2
- followed [dockerfile](https://devdiv.visualstudio.com/DevDiv/_git/DotNetCore?path=%2Fdockerfiles%2Fdebian%2F8.2%2FDockerfile&version=GBmaster) instructions for debian 8.2
- dependencies: libkrb5-dev, cmake
Get the tag name from https://hub.docker.com/r/microsoft/dotnet-buildtools-prereqs/tags/ and use in docker run below
- `docker run -it microsoft/dotnet-buildtools-prereqs:debian-8.2-SHA-YMD.. /bin/sh`
- `docker images` shows _id for Debian 8.2 to use in command below
- `docker exec -it _id /bin/sh`
## Notes on commands used in Linux 14.04
- Not supported. The minimum required unixODBC version should be 2.3.1, but is not available on Ubuntu 14.04.
## Notes on commands used in Linux 16.04
- `wget "ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz"` download and install unixODBC
- `gunzip unixODBC-2.3.4.tar.gz`
- `tar xvf unixODBC-2.3.4.tar`
- `cd unixODBC-2.3.4/`
- `./configure`
- `make`
- `sudo make install`
- `cd ..`
- `wget "http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.9995.tar.gz"` download and install SQLite ODBC Driver
- `gunzip sqliteodbc-0.9995.tar.gz`
- `tar xvf sqliteodbc-0.9995.tar`
- `cd sqliteodbc-0.9995/`
- `./configure`
- `make`
- `sudo make install`
- `sudo nano /usr/local/etc/odbcinst.ini`
```
[ODBC Drivers]
SQLite3 ODBC Driver=Installed
[SQLite3 ODBC Driver]
Description=SQLite3 ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
```
- `sudo nano /etc/odbcinst.ini`
```
[SQLite3 ODBC Driver]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=4
```
## Notes on commands used in Mac
- `gunzip unixODBC-2.3.4.tar.gz` download unixodbc
- `tar xvf unixODBC-2.3.4.tar`
- `cd unix...`
- `./configure`
- `make`
- `make install`
- `/usr/local/bin/odbcinst` try out odbcinst using the command below
- `sudo nano /etc/odbcinst.ini`
```
[SQLite3 ODBC Driver]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=4
```
- `sudo nano find / -name odbcinst.ini`
- `sudo nano /usr/local/etc/odbcinst.ini`
```
[ODBC Drivers]
SQLite3 ODBC Driver=Installed
[SQLite3 ODBC Driver]
Driver=/usr/local/lib/libsqlite3odbc.dylib
Setup=/usr/local/lib/libsqlite3odbc.dylib
```
## Notes on commands used in Windows7-10, 64 bit machine
- odbc32.dll already available, just needs to install sqlite64.exe

View File

@@ -1,7 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Security;
[assembly: SecurityTransparent]

View File

@@ -6,17 +6,29 @@
<AssemblyName>System.Data.Odbc</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' == 'netstandard' AND '$(OSGroup)' == 'AnyOS'">SR.Odbc_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' == 'netstandard'">SR.Odbc_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-FreeBSD-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-FreeBSD-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Linux-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Linux-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-OSX-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-OSX-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-FreeBSD-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-FreeBSD-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Linux-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Linux-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-OSX-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-OSX-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Linux-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Linux-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-OSX-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-OSX-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true' AND '$(OSGroup)' != 'AnyOS'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp'))">
<Compile Include="$(CommonPath)\System\Data\Common\AdapterUtil.cs">
<Link>Common\System\Data\Common\AdapterUtil.cs</Link>
</Compile>
@@ -55,7 +67,6 @@
<Compile Include="Common\System\Data\ProviderBase\DbConnectionPoolOptions.cs" />
<Compile Include="Common\System\Data\ProviderBase\DbConnectionPoolProviderInfo.cs" />
<Compile Include="Common\System\Data\ProviderBase\DbReferenceCollection.cs" />
<Compile Include="Properties\SecurityTransparent.cs" />
<Compile Include="System\Data\Odbc\DbDataRecord.cs" />
<Compile Include="System\Data\Odbc\Odbc32.cs" />
<Compile Include="System\Data\Odbc\OdbcCommand.cs">
@@ -108,16 +119,24 @@
<Compile Include="$(CommonPath)\System\Data\Common\MultipartIdentifier.cs">
<Link>Common\System\Data\Common\MultipartIdentifier.cs</Link>
</Compile>
<Compile Include="Common\System\Data\Common\UnsafeNativeMethods.cs" />
<Compile Include="$(CommonPath)\Interop\Interop.Odbc.cs">
<Link>Common\Interop\Interop.Odbc.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' ">
<Compile Include="Common\System\Data\Common\ExternDll.Linux.cs" />
<ItemGroup Condition="'$(TargetsLinux)' == 'true' OR '$(TargetsFreeBSD)' == 'true'">
<Compile Include="$(CommonPath)\Interop\Linux\Interop.Libraries.cs">
<Link>Common\Interop\Linux\Interop.Libraries.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOsx)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' ">
<Compile Include="Common\System\Data\Common\ExternDll.Osx.cs" />
<ItemGroup Condition="'$(TargetsOSX)' == 'true'">
<Compile Include="$(CommonPath)\Interop\OSX\Interop.Libraries.cs">
<Link>Common\Interop\OSX\Interop.Libraries.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' ">
<Compile Include="Common\System\Data\Common\ExternDll.Windows.cs" />
<ItemGroup Condition="'$(TargetsWindows)' == 'true' And $(TargetGroup.StartsWith('netcoreapp'))">
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="mscorlib" />
@@ -131,7 +150,6 @@
<Reference Include="System.ComponentModel.Primitives" />
<Reference Include="System.ComponentModel.TypeConverter" />
<Reference Include="System.Data.Common" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.FileVersionInfo" />
<Reference Include="System.Diagnostics.Tools" />
@@ -156,6 +174,13 @@
<Reference Include="System.Threading.Timer" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.ReaderWriter" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>
<ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp'))">
<Reference Include="System.Transactions.Local" />
</ItemGroup>
<ItemGroup>
<None Include="DatabaseSetupInstructions.md" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -123,8 +123,11 @@ namespace System.Data.Odbc
}
}
internal static class ODBC32
#if !MONO
// Class needs to be public to support serialization with type forwarding from Desktop to Core.
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public static class ODBC32
{
internal enum SQL_HANDLE : short
{
@@ -136,6 +139,9 @@ namespace System.Data.Odbc
// from .\public\sdk\inc\sqlext.h: and .\public\sdk\inc\sql.h
// must be public because it is serialized by OdbcException
#if !MONO
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public enum RETCODE : int
{ // must be int instead of short for Everett OdbcException Serializablity.
SUCCESS = 0,

View File

@@ -64,7 +64,7 @@ namespace System.Data.Odbc
try { }
finally
{
retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, ODBC32.SQL_ATTR.AUTOCOMMIT, ODBC32.SQL_AUTOCOMMIT_OFF, (Int32)ODBC32.SQL_IS.UINTEGER);
retcode = Interop.Odbc.SQLSetConnectAttrW(this, ODBC32.SQL_ATTR.AUTOCOMMIT, ODBC32.SQL_AUTOCOMMIT_OFF, (Int32)ODBC32.SQL_IS.UINTEGER);
switch (retcode)
{
case ODBC32.RetCode.SUCCESS:
@@ -172,7 +172,7 @@ namespace System.Data.Odbc
{
if (HandleState.TransactionInProgress == _handleState)
{
retcode = UnsafeNativeMethods.SQLEndTran(HandleType, handle, transactionOperation);
retcode = Interop.Odbc.SQLEndTran(HandleType, handle, transactionOperation);
if ((ODBC32.RetCode.SUCCESS == retcode) || (ODBC32.RetCode.SUCCESS_WITH_INFO == retcode))
{
_handleState = HandleState.Transacted;
@@ -181,7 +181,7 @@ namespace System.Data.Odbc
if (HandleState.Transacted == _handleState)
{ // AutoCommitOn
retcode = UnsafeNativeMethods.SQLSetConnectAttrW(handle, ODBC32.SQL_ATTR.AUTOCOMMIT, ODBC32.SQL_AUTOCOMMIT_ON, (Int32)ODBC32.SQL_IS.UINTEGER);
retcode = Interop.Odbc.SQLSetConnectAttrW(handle, ODBC32.SQL_ATTR.AUTOCOMMIT, ODBC32.SQL_AUTOCOMMIT_ON, (Int32)ODBC32.SQL_IS.UINTEGER);
_handleState = HandleState.Connected;
}
}
@@ -202,7 +202,7 @@ namespace System.Data.Odbc
finally
{
short cbActualSize;
retcode = UnsafeNativeMethods.SQLDriverConnectW(this, ADP.PtrZero, connectionString, ODBC32.SQL_NTS, ADP.PtrZero, 0, out cbActualSize, (short)ODBC32.SQL_DRIVER.NOPROMPT);
retcode = Interop.Odbc.SQLDriverConnectW(this, ADP.PtrZero, connectionString, ODBC32.SQL_NTS, ADP.PtrZero, 0, out cbActualSize, (short)ODBC32.SQL_DRIVER.NOPROMPT);
switch (retcode)
{
case ODBC32.RetCode.SUCCESS:
@@ -225,7 +225,7 @@ namespace System.Data.Odbc
if ((HandleState.Connected == _handleState) || (HandleState.TransactionInProgress == _handleState))
{
retcode = UnsafeNativeMethods.SQLDisconnect(handle);
retcode = Interop.Odbc.SQLDisconnect(handle);
_handleState = HandleState.Allocated;
}
Debug.Assert(HandleState.Allocated == _handleState, "not expected HandleState.Allocated");
@@ -234,45 +234,45 @@ namespace System.Data.Odbc
internal ODBC32.RetCode GetConnectionAttribute(ODBC32.SQL_ATTR attribute, byte[] buffer, out int cbActual)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetConnectAttrW(this, attribute, buffer, buffer.Length, out cbActual);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetConnectAttrW(this, attribute, buffer, buffer.Length, out cbActual);
return retcode;
}
internal ODBC32.RetCode GetFunctions(ODBC32.SQL_API fFunction, out Int16 fExists)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetFunctions(this, fFunction, out fExists);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetFunctions(this, fFunction, out fExists);
ODBC.TraceODBC(3, "SQLGetFunctions", retcode);
return retcode;
}
internal ODBC32.RetCode GetInfo2(ODBC32.SQL_INFO info, byte[] buffer, out short cbActual)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), out cbActual);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), out cbActual);
return retcode;
}
internal ODBC32.RetCode GetInfo1(ODBC32.SQL_INFO info, byte[] buffer)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), ADP.PtrZero);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), ADP.PtrZero);
return retcode;
}
internal ODBC32.RetCode SetConnectionAttribute2(ODBC32.SQL_ATTR attribute, IntPtr value, Int32 length)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, value, length);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetConnectAttrW(this, attribute, value, length);
ODBC.TraceODBC(3, "SQLSetConnectAttrW", retcode);
return retcode;
}
internal ODBC32.RetCode SetConnectionAttribute3(ODBC32.SQL_ATTR attribute, string buffer, Int32 length)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, buffer, length);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetConnectAttrW(this, attribute, buffer, length);
return retcode;
}
internal ODBC32.RetCode SetConnectionAttribute4(ODBC32.SQL_ATTR attribute, System.Transactions.IDtcTransaction transaction, Int32 length)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, transaction, length);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetConnectAttrW(this, attribute, transaction, length);
ODBC.TraceODBC(3, "SQLSetConnectAttrW", retcode);
return retcode;
}

View File

@@ -18,7 +18,7 @@ namespace System.Data.Odbc
//Set the expected driver manager version
//
retcode = UnsafeNativeMethods.SQLSetEnvAttr(
retcode = Interop.Odbc.SQLSetEnvAttr(
this,
ODBC32.SQL_ATTR.ODBC_VERSION,
ODBC32.SQL_OV_ODBC3,
@@ -30,7 +30,7 @@ namespace System.Data.Odbc
//handle are pooled. So we have to keep it alive and not create a new environment
//for every connection.
//
retcode = UnsafeNativeMethods.SQLSetEnvAttr(
retcode = Interop.Odbc.SQLSetEnvAttr(
this,
ODBC32.SQL_ATTR.CONNECTION_POOLING,
ODBC32.SQL_CP_ONE_PER_HENV,

View File

@@ -5,6 +5,9 @@
namespace System.Data.Odbc
{
[Serializable]
#if !MONO
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public sealed class OdbcError
{
//Data

View File

@@ -7,15 +7,18 @@ using System.Collections;
namespace System.Data.Odbc
{
[Serializable]
#if !MONO
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public sealed class OdbcErrorCollection : ICollection
{
private ArrayList _items = new ArrayList();
private ArrayList _items = new ArrayList(); // Do not rename (binary serialization)
internal OdbcErrorCollection()
{
}
Object System.Collections.ICollection.SyncRoot
object System.Collections.ICollection.SyncRoot
{
get { return this; }
}

View File

@@ -2,13 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Data.Common;
using System.Runtime.Serialization;
using System.Text;
namespace System.Data.Odbc
{
[Serializable]
#if !MONO
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public sealed class OdbcException : System.Data.Common.DbException
{
private OdbcErrorCollection _odbcErrors = new OdbcErrorCollection();
@@ -35,6 +37,13 @@ namespace System.Data.Odbc
HResult = HResults.OdbcException;
}
private OdbcException(SerializationInfo si, StreamingContext sc) : base(si, sc)
{
// Ignoring ODBC32.RETCODE
_odbcErrors = (OdbcErrorCollection)si.GetValue("odbcErrors", typeof(OdbcErrorCollection));
HResult = HResults.OdbcException;
}
public OdbcErrorCollection Errors
{
get
@@ -46,6 +55,8 @@ namespace System.Data.Odbc
public override void GetObjectData(SerializationInfo si, StreamingContext context)
{
base.GetObjectData(si, context);
si.AddValue("odbcRetcode", default(ODBC32.RETCODE), typeof(ODBC32.RETCODE)); // Using default value of ODBC32.RETCODE
si.AddValue("odbcErrors", _odbcErrors, typeof(OdbcErrorCollection));
}
// mdac bug 62559 - if we don't have it return nothing (empty string)

View File

@@ -31,7 +31,7 @@ namespace System.Data.Odbc
{
case ODBC32.SQL_HANDLE.ENV:
Debug.Assert(null == parentHandle, "did not expect a parent handle");
retcode = UnsafeNativeMethods.SQLAllocHandle(handleType, IntPtr.Zero, out base.handle);
retcode = Interop.Odbc.SQLAllocHandle(handleType, IntPtr.Zero, out base.handle);
break;
case ODBC32.SQL_HANDLE.DBC:
case ODBC32.SQL_HANDLE.STMT:
@@ -39,7 +39,7 @@ namespace System.Data.Odbc
Debug.Assert(null != parentHandle, "expected a parent handle"); // safehandle can't be null
parentHandle.DangerousAddRef(ref mustRelease);
retcode = UnsafeNativeMethods.SQLAllocHandle(handleType, parentHandle, out base.handle);
retcode = Interop.Odbc.SQLAllocHandle(handleType, parentHandle, out base.handle);
break;
// case ODBC32.SQL_HANDLE.DESC:
default:
@@ -151,7 +151,7 @@ namespace System.Data.Odbc
// Disconnect happens in OdbcConnectionHandle.ReleaseHandle
case ODBC32.SQL_HANDLE.ENV:
case ODBC32.SQL_HANDLE.STMT:
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLFreeHandle(handleType, handle);
ODBC32.RetCode retcode = Interop.Odbc.SQLFreeHandle(handleType, handle);
break;
case ODBC32.SQL_HANDLE.DESC:
@@ -182,7 +182,7 @@ namespace System.Data.Odbc
short cbActual;
// ODBC (MSDN) documents it expects a buffer large enough to hold 5(+L'\0') unicode characters
StringBuilder sb = new StringBuilder(6);
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetDiagFieldW(
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDiagFieldW(
HandleType,
this,
(short)1,
@@ -206,7 +206,7 @@ namespace System.Data.Odbc
{
// ODBC (MSDN) documents it expects a buffer large enough to hold 4(+L'\0') unicode characters
StringBuilder sb = new StringBuilder(5);
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetDiagRecW(HandleType, this, record, sb, out nativeError, message, checked((short)message.Capacity), out cchActual);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDiagRecW(HandleType, this, record, sb, out nativeError, message, checked((short)message.Capacity), out cchActual);
ODBC.TraceODBC(3, "SQLGetDiagRecW", retcode);
if ((retcode == ODBC32.RetCode.SUCCESS) || (retcode == ODBC32.RetCode.SUCCESS_WITH_INFO))
@@ -229,21 +229,21 @@ namespace System.Data.Odbc
internal ODBC32.RetCode GetDescriptionField(int i, ODBC32.SQL_DESC attribute, CNativeBuffer buffer, out int numericAttribute)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetDescFieldW(this, checked((short)i), attribute, buffer, buffer.ShortLength, out numericAttribute);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDescFieldW(this, checked((short)i), attribute, buffer, buffer.ShortLength, out numericAttribute);
ODBC.TraceODBC(3, "SQLGetDescFieldW", retcode);
return retcode;
}
internal ODBC32.RetCode SetDescriptionField1(short ordinal, ODBC32.SQL_DESC type, IntPtr value)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC.TraceODBC(3, "SQLSetDescFieldW", retcode);
return retcode;
}
internal ODBC32.RetCode SetDescriptionField2(short ordinal, ODBC32.SQL_DESC type, HandleRef value)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC.TraceODBC(3, "SQLSetDescFieldW", retcode);
return retcode;
}

View File

@@ -12,7 +12,7 @@ namespace System.Data.Odbc
{
internal class OdbcMetaDataFactory : DbMetaDataFactory
{
private struct SchemaFunctionName
private readonly struct SchemaFunctionName
{
internal SchemaFunctionName(string schemaName, ODBC32.SQL_API odbcFunction)
{

View File

@@ -69,21 +69,21 @@ namespace System.Data.Odbc
internal ODBC32.RetCode BindColumn2(int columnNumber, ODBC32.SQL_C targetType, HandleRef buffer, IntPtr length, IntPtr srLen_or_Ind)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLBindCol(this, checked((ushort)columnNumber), targetType, buffer, length, srLen_or_Ind);
ODBC32.RetCode retcode = Interop.Odbc.SQLBindCol(this, checked((ushort)columnNumber), targetType, buffer, length, srLen_or_Ind);
ODBC.TraceODBC(3, "SQLBindCol", retcode);
return retcode;
}
internal ODBC32.RetCode BindColumn3(int columnNumber, ODBC32.SQL_C targetType, IntPtr srLen_or_Ind)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLBindCol(this, checked((ushort)columnNumber), targetType, ADP.PtrZero, ADP.PtrZero, srLen_or_Ind);
ODBC32.RetCode retcode = Interop.Odbc.SQLBindCol(this, checked((ushort)columnNumber), targetType, ADP.PtrZero, ADP.PtrZero, srLen_or_Ind);
ODBC.TraceODBC(3, "SQLBindCol", retcode);
return retcode;
}
internal ODBC32.RetCode BindParameter(short ordinal, short parameterDirection, ODBC32.SQL_C sqlctype, ODBC32.SQL_TYPE sqltype, IntPtr cchSize, IntPtr scale, HandleRef buffer, IntPtr bufferLength, HandleRef intbuffer)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLBindParameter(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLBindParameter(this,
checked((ushort)ordinal), // Parameter Number
parameterDirection, // InputOutputType
sqlctype, // ValueType
@@ -101,14 +101,14 @@ namespace System.Data.Odbc
{
// In ODBC3.0 ... a call to SQLCancel when no processing is done has no effect at all
// (ODBC Programmer's Reference ...)
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLCancel(this);
ODBC32.RetCode retcode = Interop.Odbc.SQLCancel(this);
ODBC.TraceODBC(3, "SQLCancel", retcode);
return retcode;
}
internal ODBC32.RetCode CloseCursor()
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLCloseCursor(this);
ODBC32.RetCode retcode = Interop.Odbc.SQLCloseCursor(this);
ODBC.TraceODBC(3, "SQLCloseCursor", retcode);
return retcode;
}
@@ -116,7 +116,7 @@ namespace System.Data.Odbc
internal ODBC32.RetCode ColumnAttribute(int columnNumber, short fieldIdentifier, CNativeBuffer characterAttribute, out short stringLength, out SQLLEN numericAttribute)
{
IntPtr result;
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLColAttributeW(this, checked((short)columnNumber), fieldIdentifier, characterAttribute, characterAttribute.ShortLength, out stringLength, out result);
ODBC32.RetCode retcode = Interop.Odbc.SQLColAttributeW(this, checked((short)columnNumber), fieldIdentifier, characterAttribute, characterAttribute.ShortLength, out stringLength, out result);
numericAttribute = new SQLLEN(result);
ODBC.TraceODBC(3, "SQLColAttributeW", retcode);
return retcode;
@@ -127,7 +127,7 @@ namespace System.Data.Odbc
string tableName,
string columnName)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLColumnsW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLColumnsW(this,
tableCatalog,
ODBC.ShortStringLength(tableCatalog),
tableSchema,
@@ -143,35 +143,35 @@ namespace System.Data.Odbc
internal ODBC32.RetCode Execute()
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLExecute(this);
ODBC32.RetCode retcode = Interop.Odbc.SQLExecute(this);
ODBC.TraceODBC(3, "SQLExecute", retcode);
return retcode;
}
internal ODBC32.RetCode ExecuteDirect(string commandText)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLExecDirectW(this, commandText, ODBC32.SQL_NTS);
ODBC32.RetCode retcode = Interop.Odbc.SQLExecDirectW(this, commandText, ODBC32.SQL_NTS);
ODBC.TraceODBC(3, "SQLExecDirectW", retcode);
return retcode;
}
internal ODBC32.RetCode Fetch()
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLFetch(this);
ODBC32.RetCode retcode = Interop.Odbc.SQLFetch(this);
ODBC.TraceODBC(3, "SQLFetch", retcode);
return retcode;
}
internal ODBC32.RetCode FreeStatement(ODBC32.STMT stmt)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLFreeStmt(this, stmt);
ODBC32.RetCode retcode = Interop.Odbc.SQLFreeStmt(this, stmt);
ODBC.TraceODBC(3, "SQLFreeStmt", retcode);
return retcode;
}
internal ODBC32.RetCode GetData(int index, ODBC32.SQL_C sqlctype, CNativeBuffer buffer, int cb, out IntPtr cbActual)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetData(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLGetData(this,
checked((ushort)index),
sqlctype,
buffer,
@@ -183,42 +183,42 @@ namespace System.Data.Odbc
internal ODBC32.RetCode GetStatementAttribute(ODBC32.SQL_ATTR attribute, out IntPtr value, out int stringLength)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetStmtAttrW(this, attribute, out value, ADP.PtrSize, out stringLength);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetStmtAttrW(this, attribute, out value, ADP.PtrSize, out stringLength);
ODBC.TraceODBC(3, "SQLGetStmtAttrW", retcode);
return retcode;
}
internal ODBC32.RetCode GetTypeInfo(Int16 fSqlType)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetTypeInfo(this, fSqlType);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetTypeInfo(this, fSqlType);
ODBC.TraceODBC(3, "SQLGetTypeInfo", retcode);
return retcode;
}
internal ODBC32.RetCode MoreResults()
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLMoreResults(this);
ODBC32.RetCode retcode = Interop.Odbc.SQLMoreResults(this);
ODBC.TraceODBC(3, "SQLMoreResults", retcode);
return retcode;
}
internal ODBC32.RetCode NumberOfResultColumns(out short columnsAffected)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLNumResultCols(this, out columnsAffected);
ODBC32.RetCode retcode = Interop.Odbc.SQLNumResultCols(this, out columnsAffected);
ODBC.TraceODBC(3, "SQLNumResultCols", retcode);
return retcode;
}
internal ODBC32.RetCode Prepare(string commandText)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLPrepareW(this, commandText, ODBC32.SQL_NTS);
ODBC32.RetCode retcode = Interop.Odbc.SQLPrepareW(this, commandText, ODBC32.SQL_NTS);
ODBC.TraceODBC(3, "SQLPrepareW", retcode);
return retcode;
}
internal ODBC32.RetCode PrimaryKeys(string catalogName, string schemaName, string tableName)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLPrimaryKeysW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLPrimaryKeysW(this,
catalogName, ODBC.ShortStringLength(catalogName), // CatalogName
schemaName, ODBC.ShortStringLength(schemaName), // SchemaName
tableName, ODBC.ShortStringLength(tableName) // TableName
@@ -231,7 +231,7 @@ namespace System.Data.Odbc
string procedureSchema,
string procedureName)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLProceduresW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLProceduresW(this,
procedureCatalog,
ODBC.ShortStringLength(procedureCatalog),
procedureSchema,
@@ -248,7 +248,7 @@ namespace System.Data.Odbc
string procedureName,
string columnName)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLProcedureColumnsW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLProcedureColumnsW(this,
procedureCatalog,
ODBC.ShortStringLength(procedureCatalog),
procedureSchema,
@@ -265,7 +265,7 @@ namespace System.Data.Odbc
internal ODBC32.RetCode RowCount(out SQLLEN rowCount)
{
IntPtr result;
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLRowCount(this, out result);
ODBC32.RetCode retcode = Interop.Odbc.SQLRowCount(this, out result);
rowCount = new SQLLEN(result);
ODBC.TraceODBC(3, "SQLRowCount", retcode);
return retcode;
@@ -273,14 +273,14 @@ namespace System.Data.Odbc
internal ODBC32.RetCode SetStatementAttribute(ODBC32.SQL_ATTR attribute, IntPtr value, ODBC32.SQL_IS stringLength)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetStmtAttrW(this, (int)attribute, value, (int)stringLength);
ODBC32.RetCode retcode = Interop.Odbc.SQLSetStmtAttrW(this, (int)attribute, value, (int)stringLength);
ODBC.TraceODBC(3, "SQLSetStmtAttrW", retcode);
return retcode;
}
internal ODBC32.RetCode SpecialColumns(string quotedTable)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSpecialColumnsW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLSpecialColumnsW(this,
ODBC32.SQL_SPECIALCOLS.ROWVER, null, 0, null, 0,
quotedTable, ODBC.ShortStringLength(quotedTable),
ODBC32.SQL_SCOPE.SESSION, ODBC32.SQL_NULLABILITY.NO_NULLS);
@@ -294,7 +294,7 @@ namespace System.Data.Odbc
Int16 unique,
Int16 accuracy)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLStatisticsW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLStatisticsW(this,
tableCatalog,
ODBC.ShortStringLength(tableCatalog),
tableSchema,
@@ -310,7 +310,7 @@ namespace System.Data.Odbc
internal ODBC32.RetCode Statistics(string tableName)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLStatisticsW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLStatisticsW(this,
null, 0, null, 0,
tableName, ODBC.ShortStringLength(tableName),
(Int16)ODBC32.SQL_INDEX.UNIQUE,
@@ -324,7 +324,7 @@ namespace System.Data.Odbc
string tableName,
string tableType)
{
ODBC32.RetCode retcode = UnsafeNativeMethods.SQLTablesW(this,
ODBC32.RetCode retcode = Interop.Odbc.SQLTablesW(this,
tableCatalog,
ODBC.ShortStringLength(tableCatalog),
tableSchema,

Some files were not shown because too many files have changed in this diff Show More