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); } }
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); } }
internal static ArgumentException NotSupportedSchemaTable(Guid schema, OleDbConnection connection) { return(ADP.Argument(SR.Format(SR.OleDb_NotSupportedSchemaTable, OleDbSchemaGuid.GetTextFromValue(schema), connection.Provider))); }
internal static ArgumentException NotSupportedSchemaTable(Guid schema, OleDbConnection connection) { return(ADP.Argument(Res.GetString("OleDb_NotSupportedSchemaTable", new object[] { OleDbSchemaGuid.GetTextFromValue(schema), connection.Provider }))); }