internal object GetPropertyValue(Guid propertySet, int propertyID) { if (null != _icommandText) { OleDbHResult hr; tagDBPROP[] dbprops; UnsafeNativeMethods.ICommandProperties icommandProperties = ICommandProperties(); using (PropertyIDSet propidset = new PropertyIDSet(propertySet, propertyID)) { using (DBPropSet propset = new DBPropSet(icommandProperties, propidset, out hr)) { if (hr < 0) { // OLEDB Data Reader masks provider specific errors by raising "Internal Data Provider error 30." // DBPropSet c-tor will register the exception and it will be raised at GetPropertySet call in case of failure SafeNativeMethods.Wrapper.ClearErrorInfo(); } dbprops = propset.GetPropertySet(0, out propertySet); } } if (OleDbPropertyStatus.Ok == dbprops[0].dwStatus) { return(dbprops[0].vValue); } return(dbprops[0].dwStatus); } return(OleDbPropertyStatus.NotSupported); }
internal DBPropSet(UnsafeNativeMethods.ICommandProperties properties, PropertyIDSet propidset, out OleDbHResult hr) : this() { int cPropertyIDSets = 0; if (propidset != null) { cPropertyIDSets = propidset.Count; } Bid.Trace("<oledb.ICommandProperties.GetProperties|API|OLEDB>\n"); hr = properties.GetProperties(cPropertyIDSets, propidset, out this.propertySetCount, out this.handle); Bid.Trace("<oledb.ICommandProperties.GetProperties|API|OLEDB|RET> %08X{HRESULT}\n", hr); if (hr < OleDbHResult.S_OK) { this.SetLastErrorInfo(hr); } }
private bool PropertiesOnCommand(bool throwNotSupported) { if (null != _icommandText) { return(true); } Debug.Assert(!_isPrepared, "null command isPrepared"); OleDbConnection connection = _connection; if (null == connection) { connection.CheckStateOpen(ODB.Properties); } if (!_trackingForClose) { _trackingForClose = true; connection.AddWeakReference(this, OleDbReferenceCollection.CommandTag); } _icommandText = connection.ICommandText(); if (null == _icommandText) { if (throwNotSupported || HasParameters()) { throw ODB.CommandTextNotSupported(connection.Provider, null); } return(false); } using (DBPropSet propSet = CommandPropertySets()) { if (null != propSet) { UnsafeNativeMethods.ICommandProperties icommandProperties = ICommandProperties(); OleDbHResult hr = icommandProperties.SetProperties(propSet.PropertySetCount, propSet); if (hr < 0) { SafeNativeMethods.Wrapper.ClearErrorInfo(); } } } return(true); }
internal DBPropSet(UnsafeNativeMethods.ICommandProperties properties, PropertyIDSet propidset, out OleDbHResult hr) : this() { Debug.Assert(null != properties, "null ICommandProperties"); int propidsetcount = 0; if (null != propidset) { propidsetcount = propidset.Count; } hr = properties.GetProperties(propidsetcount, propidset, out this.propertySetCount, out base.handle); if (hr < 0) { // remember the last HRESULT. Note we do not want to raise exception now to avoid breaking change from Orcas RTM/SP1 SetLastErrorInfo(hr); } }