public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions) // MDAC 61846 { OleDbConnection.ExecutePermission.Demand(); IntPtr hscp; Bid.ScopeEnter(out hscp, "<oledb.OleDbConnection.GetOleDbSchemaTable|API> %d#, schema=%ls, restrictions\n", ObjectID, schema); try { CheckStateOpen(ADP.GetOleDbSchemaTable); OleDbConnectionInternal connection = GetOpenConnection(); if (OleDbSchemaGuid.DbInfoLiterals == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildInfoLiterals()); } throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions"); } else if (OleDbSchemaGuid.SchemaGuids == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildSchemaGuids()); } throw ODB.InvalidRestrictionsSchemaGuids("restrictions"); } else if (OleDbSchemaGuid.DbInfoKeywords == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildInfoKeywords()); } throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions"); } if (connection.SupportSchemaRowset(schema)) { return(connection.GetSchemaRowset(schema, restrictions)); } else { using (IDBSchemaRowsetWrapper wrapper = connection.IDBSchemaRowset()) { if (null == wrapper.Value) { throw ODB.SchemaRowsetsNotSupported(Provider); // MDAC 72689 } } throw ODB.NotSupportedSchemaTable(schema, this); // MDAC 63279 } } finally { Bid.ScopeLeave(ref hscp); } }
public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions) { DataTable table; IntPtr ptr; ExecutePermission.Demand(); Bid.ScopeEnter(out ptr, "<oledb.OleDbConnection.GetOleDbSchemaTable|API> %d#, schema=%ls, restrictions\n", this.ObjectID, schema); try { this.CheckStateOpen("GetOleDbSchemaTable"); OleDbConnectionInternal openConnection = this.GetOpenConnection(); if (OleDbSchemaGuid.DbInfoLiterals == schema) { if ((restrictions != null) && (restrictions.Length != 0)) { throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions"); } return(openConnection.BuildInfoLiterals()); } if (OleDbSchemaGuid.SchemaGuids == schema) { if ((restrictions != null) && (restrictions.Length != 0)) { throw ODB.InvalidRestrictionsSchemaGuids("restrictions"); } return(openConnection.BuildSchemaGuids()); } if (OleDbSchemaGuid.DbInfoKeywords == schema) { if ((restrictions != null) && (restrictions.Length != 0)) { throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions"); } return(openConnection.BuildInfoKeywords()); } if (openConnection.SupportSchemaRowset(schema)) { return(openConnection.GetSchemaRowset(schema, restrictions)); } using (IDBSchemaRowsetWrapper wrapper = openConnection.IDBSchemaRowset()) { if (wrapper.Value == null) { throw ODB.SchemaRowsetsNotSupported(this.Provider); } } throw ODB.NotSupportedSchemaTable(schema, this); } finally { Bid.ScopeLeave(ref ptr); } return(table); }
internal DataTable GetSchemaRowset(Guid schema, object[] restrictions) { DataTable table2; IntPtr ptr; Bid.ScopeEnter(out ptr, "<oledb.OleDbConnectionInternal.GetSchemaRowset|INFO> %d#, schema=%ls, restrictions\n", base.ObjectID, schema); try { if (restrictions == null) { restrictions = new object[0]; } DataTable table = null; using (IDBSchemaRowsetWrapper wrapper = this.IDBSchemaRowset()) { System.Data.Common.UnsafeNativeMethods.IDBSchemaRowset rowset2 = wrapper.Value; if (rowset2 == null) { throw ODB.SchemaRowsetsNotSupported(this.Provider); } System.Data.Common.UnsafeNativeMethods.IRowset ppRowset = null; Bid.Trace("<oledb.IDBSchemaRowset.GetRowset|API|OLEDB> %d#\n", base.ObjectID); OleDbHResult result = rowset2.GetRowset(ADP.PtrZero, ref schema, restrictions.Length, restrictions, ref ODB.IID_IRowset, 0, ADP.PtrZero, out ppRowset); Bid.Trace("<oledb.IDBSchemaRowset.GetRowset|API|OLEDB|RET> %08X{HRESULT}\n", result); if (result < OleDbHResult.S_OK) { this.ProcessResults(result); } if (ppRowset != null) { using (OleDbDataReader reader = new OleDbDataReader(this.Connection, null, 0, CommandBehavior.Default)) { reader.InitializeIRowset(ppRowset, ChapterHandle.DB_NULL_HCHAPTER, IntPtr.Zero); reader.BuildMetaInfo(); reader.HasRowsRead(); table = new DataTable { Locale = CultureInfo.InvariantCulture, TableName = OleDbSchemaGuid.GetTextFromValue(schema) }; OleDbDataAdapter.FillDataTable(reader, new DataTable[] { table }); } } return(table); } } finally { Bid.ScopeLeave(ref ptr); } return(table2); }
internal DataTable GetSchemaRowset(Guid schema, object[] restrictions) { IntPtr hscp; Bid.ScopeEnter(out hscp, "<oledb.OleDbConnectionInternal.GetSchemaRowset|INFO> %d#, schema=%ls, restrictions\n", ObjectID, schema); try { if (null == restrictions) // MDAC 62243 { restrictions = new object[0]; } DataTable dataTable = null; using (IDBSchemaRowsetWrapper wrapper = IDBSchemaRowset()) { UnsafeNativeMethods.IDBSchemaRowset dbSchemaRowset = wrapper.Value; if (null == dbSchemaRowset) { throw ODB.SchemaRowsetsNotSupported(Provider); } UnsafeNativeMethods.IRowset rowset = null; OleDbHResult hr; Bid.Trace("<oledb.IDBSchemaRowset.GetRowset|API|OLEDB> %d#\n", ObjectID); hr = dbSchemaRowset.GetRowset(ADP.PtrZero, ref schema, restrictions.Length, restrictions, ref ODB.IID_IRowset, 0, ADP.PtrZero, out rowset); Bid.Trace("<oledb.IDBSchemaRowset.GetRowset|API|OLEDB|RET> %08X{HRESULT}\n", hr); if (hr < 0) // ignore infomsg { ProcessResults(hr); } if (null != rowset) { using (OleDbDataReader dataReader = new OleDbDataReader(Connection, null, 0, CommandBehavior.Default)) { dataReader.InitializeIRowset(rowset, ChapterHandle.DB_NULL_HCHAPTER, IntPtr.Zero); dataReader.BuildMetaInfo(); dataReader.HasRowsRead(); dataTable = new DataTable(); dataTable.Locale = CultureInfo.InvariantCulture; dataTable.TableName = OleDbSchemaGuid.GetTextFromValue(schema); OleDbDataAdapter.FillDataTable(dataReader, dataTable); } } return(dataTable); } } finally { Bid.ScopeLeave(ref hscp); } }
public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions) { CheckStateOpen(ADP.GetOleDbSchemaTable); OleDbConnectionInternal connection = GetOpenConnection(); if (OleDbSchemaGuid.DbInfoLiterals == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildInfoLiterals()); } throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions"); } else if (OleDbSchemaGuid.SchemaGuids == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildSchemaGuids()); } throw ODB.InvalidRestrictionsSchemaGuids("restrictions"); } else if (OleDbSchemaGuid.DbInfoKeywords == schema) { if ((null == restrictions) || (0 == restrictions.Length)) { return(connection.BuildInfoKeywords()); } throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions"); } if (connection.SupportSchemaRowset(schema)) { return(connection.GetSchemaRowset(schema, restrictions)); } else { using (IDBSchemaRowsetWrapper wrapper = connection.IDBSchemaRowset()) { if (null == wrapper.Value) { throw ODB.SchemaRowsetsNotSupported(Provider); } } throw ODB.NotSupportedSchemaTable(schema, this); } }
internal DataTable GetSchemaRowset(Guid schema, object[] restrictions) { if (null == restrictions) { restrictions = Array.Empty <object>(); } DataTable dataTable = null; using (IDBSchemaRowsetWrapper wrapper = IDBSchemaRowset()) { UnsafeNativeMethods.IDBSchemaRowset dbSchemaRowset = wrapper.Value; if (null == dbSchemaRowset) { throw ODB.SchemaRowsetsNotSupported(Provider); } UnsafeNativeMethods.IRowset rowset = null; OleDbHResult hr; hr = dbSchemaRowset.GetRowset(ADP.PtrZero, ref schema, restrictions.Length, restrictions, ref ODB.IID_IRowset, 0, ADP.PtrZero, out rowset); if (hr < 0) { // ignore infomsg ProcessResults(hr); } if (null != rowset) { using (OleDbDataReader dataReader = new OleDbDataReader(Connection, null, 0, CommandBehavior.Default)) { dataReader.InitializeIRowset(rowset, ChapterHandle.DB_NULL_HCHAPTER, IntPtr.Zero); dataReader.BuildMetaInfo(); dataReader.HasRowsRead(); dataTable = new DataTable(); dataTable.Locale = CultureInfo.InvariantCulture; dataTable.TableName = OleDbSchemaGuid.GetTextFromValue(schema); OleDbDataAdapter.FillDataTable(dataReader, dataTable); } } return(dataTable); } }