private Keywords GetIndex(string keyword) { ADP.CheckArgumentNull(keyword, nameof(keyword)); Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { return(index); } throw UnsupportedKeyword(keyword); }
public void ClearPool(DbConnection connection) { ADP.CheckArgumentNull(connection, nameof(connection)); DbConnectionPoolGroup poolGroup = GetConnectionPoolGroup(connection); if (null != poolGroup) { poolGroup.Clear(); } }
static public void ClearPool(SqlConnection connection) { ADP.CheckArgumentNull(connection, "connection"); DbConnectionOptions connectionOptions = connection.UserConnectionOptions; if (null != connectionOptions) { SqlConnectionFactory.SingletonInstance.ClearPool(connection); } }
private OdbcParameter(OdbcParameter source) : this() { ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable cloneable = this._value as ICloneable; if (cloneable != null) { this._value = cloneable.Clone(); } }
public DbMetaDataFactory(Stream xmlStream, string serverVersion, string normalizedServerVersion) { ADP.CheckArgumentNull(xmlStream, nameof(xmlStream)); ADP.CheckArgumentNull(serverVersion, nameof(serverVersion)); ADP.CheckArgumentNull(normalizedServerVersion, nameof(normalizedServerVersion)); LoadDataSetFromXml(xmlStream); _serverVersionString = serverVersion; _normalizedServerVersion = normalizedServerVersion; }
public override bool TryGetValue(string keyword, out object value) { ADP.CheckArgumentNull(keyword, "keyword"); Keywords index; if (_keywords.TryGetValue(keyword, out index)) { value = GetAt(index); return(true); } return(base.TryGetValue(keyword, out value)); }
public override string UnquoteIdentifier(string quotedIdentifier) { ADP.CheckArgumentNull(quotedIdentifier, "quotedIdentifier"); String unquotedIdentifier; string quoteSuffixLocal = QuoteSuffix; string quotePrefixLocal = QuotePrefix; ConsistentQuoteDelimiters(quotePrefixLocal, quoteSuffixLocal); // ignoring the return value becasue an unquoted source string is OK here ADP.RemoveStringQuotes(quotePrefixLocal, quoteSuffixLocal, quotedIdentifier, out unquotedIdentifier); return(unquotedIdentifier); }
// Send results from SqlDataReader public void Send(SqlDataReader reader) { ADP.CheckArgumentNull(reader, "reader"); SetPipeBusy( ); try { EnsureNormalSendValid("Send"); do { SmiExtendedMetaData[] columnMetaData = reader.GetInternalSmiMetaData(); if (null != columnMetaData && 0 != columnMetaData.Length) // SQLBUDT #340528 -- don't send empty results. { using (SmiRecordBuffer recordBuffer = _smiContext.CreateRecordBuffer(columnMetaData, _eventSink)) { _eventSink.ProcessMessagesAndThrow(); // Handle any errors that are reported. _smiContext.SendResultsStartToPipe(recordBuffer, _eventSink); _eventSink.ProcessMessagesAndThrow(); // Handle any errors that are reported. try { while (reader.Read( )) { if (SmiContextFactory.Instance.NegotiatedSmiVersion >= SmiContextFactory.KatmaiVersion) { ValueUtilsSmi.FillCompatibleSettersFromReader(_eventSink, recordBuffer, new List <SmiExtendedMetaData>(columnMetaData), reader); } else { ValueUtilsSmi.FillCompatibleITypedSettersFromReader(_eventSink, recordBuffer, columnMetaData, reader); } _smiContext.SendResultsRowToPipe(recordBuffer, _eventSink); _eventSink.ProcessMessagesAndThrow(); // Handle any errors that are reported. } } finally { _smiContext.SendResultsEndToPipe(recordBuffer, _eventSink); _eventSink.ProcessMessagesAndThrow(); // Handle any errors that are reported. } } } }while (reader.NextResult( )); } catch { _eventSink.CleanMessages(); throw; } finally { ClearPipeBusy( ); Debug.Assert(_eventSink.HasMessages == false, "There should be no messages left in _eventsink at the end of the Send reader!"); } }
public override string UnquoteIdentifier(string quotedIdentifier) { string str3; ADP.CheckArgumentNull(quotedIdentifier, "quotedIdentifier"); string quoteSuffix = this.QuoteSuffix; string quotePrefix = this.QuotePrefix; this.ConsistentQuoteDelimiters(quotePrefix, quoteSuffix); ADP.RemoveStringQuotes(quotePrefix, quoteSuffix, quotedIdentifier, out str3); return(str3); }
public void ClearPool(DbConnectionPoolKey key) { ADP.CheckArgumentNull(key.ConnectionString, nameof(key) + "." + nameof(key.ConnectionString)); DbConnectionPoolGroup poolGroup; Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (connectionPoolGroups.TryGetValue(key, out poolGroup)) { poolGroup.Clear(); } }
public override bool TryGetValue(string keyword, [NotNullWhen(true)] out object?value) { ADP.CheckArgumentNull(keyword, nameof(keyword)); Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { value = GetAt(index); return(true); } return(base.TryGetValue(keyword, out value)); }
public void ClearPool(DbConnection connection) { ADP.CheckArgumentNull(connection, nameof(connection)); using (TryEventScope.Create("<prov.DbConnectionFactory.ClearPool|API> {0}", GetObjectId(connection))) { DbConnectionPoolGroup poolGroup = GetConnectionPoolGroup(connection); if (null != poolGroup) { poolGroup.Clear(); } } }
public override bool TryGetValue(string keyword, out object value) { Keywords keywords; ADP.CheckArgumentNull(keyword, "keyword"); if (_keywords.TryGetValue(keyword, out keywords)) { value = this.GetAt(keywords); return(true); } return(base.TryGetValue(keyword, out value)); }
public void ClearPool(DbConnectionPoolKey key) { Debug.Assert(key != null, "key cannot be null"); ADP.CheckArgumentNull(key.ConnectionString, nameof(key) + "." + nameof(key.ConnectionString)); using (TryEventScope.Create("<prov.DbConnectionFactory.ClearPool|API> connectionString")) { Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (connectionPoolGroups.TryGetValue(key, out DbConnectionPoolGroup poolGroup)) { poolGroup.Clear(); } } }
private OdbcParameter(OdbcParameter source) : this() // V1.2.3300, Clone { ADP.CheckArgumentNull(source, nameof(source)); source.CloneHelper(this); ICloneable cloneable = (_value as ICloneable); if (null != cloneable) { // MDAC 49322 _value = cloneable.Clone(); } }
public void ClearPool(DbConnectionPoolKey key) { Debug.Assert(key != null, "key cannot be null"); ADP.CheckArgumentNull(key.ConnectionString, nameof(key) + "." + nameof(key.ConnectionString)); DbConnectionPoolGroup?poolGroup; Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (connectionPoolGroups.TryGetValue(key, out poolGroup)) { poolGroup.Clear(); } }
private OleDbParameter(OleDbParameter source) : this() { // V1.2.3300, Clone ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable?cloneable = (_value as ICloneable); if (null != cloneable) { _value = cloneable.Clone(); } }
private PARAMETEROBJECTNAME(PARAMETEROBJECTNAME source) : this() // V1.2.3300, Clone { ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable cloneable = (_value as ICloneable); if (null != cloneable) // MDAC 49322 { _value = cloneable.Clone(); } }
private SqlParameter(SqlParameter source) : this() { // V1.2.3300, Clone ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable cloneable = (_value as ICloneable); if (null != cloneable) { // MDAC 49322 _value = cloneable.Clone(); } }
public void SendResultsRow(SqlDataRecord record) { ADP.CheckArgumentNull(record, "record"); SetPipeBusy( ); try { EnsureResultStarted("SendResultsRow"); if (_hadErrorInResultSet) { throw SQL.SqlPipeErrorRequiresSendEnd(); } // Assume error state unless cleared below _hadErrorInResultSet = true; SmiRecordBuffer recordBuffer; if (record.RecordContext == _smiContext) { recordBuffer = record.RecordBuffer; } else { SmiExtendedMetaData[] columnMetaData = record.InternalGetSmiMetaData(); recordBuffer = _smiContext.CreateRecordBuffer(columnMetaData, _eventSink); if (SmiContextFactory.Instance.NegotiatedSmiVersion >= SmiContextFactory.KatmaiVersion) { ValueUtilsSmi.FillCompatibleSettersFromRecord(_eventSink, recordBuffer, columnMetaData, record, null /* no default values */); } else { ValueUtilsSmi.FillCompatibleITypedSettersFromRecord(_eventSink, recordBuffer, columnMetaData, record); } } _smiContext.SendResultsRowToPipe(recordBuffer, _eventSink); // Handle any errors that are reported. _eventSink.ProcessMessagesAndThrow(); // We successfully traversed the send, clear error state _hadErrorInResultSet = false; } catch { _eventSink.CleanMessages(); throw; } finally { ClearPipeBusy( ); Debug.Assert(_eventSink.HasMessages == false, "There should be no messages left in _eventsink at the end of the SendResultsRow!"); } }
public static void ClearPool(SqlConnection connection) { ADP.CheckArgumentNull(connection, "connection"); DbConnectionOptions userConnectionOptions = connection.UserConnectionOptions; if (userConnectionOptions != null) { userConnectionOptions.DemandPermission(); if (connection.IsContextConnection) { throw SQL.NotAvailableOnContextConnection(); } SqlConnectionFactory.SingletonInstance.ClearPool(connection); } }
internal void CopyTo(SqlParameter destination) { ADP.CheckArgumentNull(destination, nameof(destination)); // NOTE: _parent is not cloned destination._value = _value; destination._direction = _direction; destination._size = _size; destination._offset = _offset; destination._sourceColumn = _sourceColumn; destination._sourceVersion = _sourceVersion; destination._sourceColumnNullMapping = _sourceColumnNullMapping; destination._isNullable = _isNullable; }
public DbMetaDataFactory(Stream xmlStream, string serverVersion, string normalizedServerVersion) { ADP.CheckArgumentNull(xmlStream, "xmlStream"); ADP.CheckArgumentNull(serverVersion, "serverVersion"); ADP.CheckArgumentNull(normalizedServerVersion, "normalizedServerVersion"); _metaDataCollectionsDataSet = new DataSet { Locale = CultureInfo.InvariantCulture }; _metaDataCollectionsDataSet.ReadXml(xmlStream); _serverVersionString = serverVersion; _normalizedServerVersion = normalizedServerVersion; }
private void CopyFrom(OdbcConnection connection) { ADP.CheckArgumentNull(connection, "connection"); this._userConnectionOptions = connection.UserConnectionOptions; this._poolGroup = connection.PoolGroup; if (DbConnectionClosedNeverOpened.SingletonInstance == connection._innerConnection) { this._innerConnection = DbConnectionClosedNeverOpened.SingletonInstance; } else { this._innerConnection = DbConnectionClosedPreviouslyOpened.SingletonInstance; } }
public override bool Remove(string keyword) { ADP.CheckArgumentNull(keyword, nameof(keyword)); Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { if (base.Remove(s_validKeywords[(int)index])) { Reset(index); return(true); } } return(false); }
private void CopyFrom(SqlConnection connection) { ADP.CheckArgumentNull(connection, nameof(connection)); _userConnectionOptions = connection.UserConnectionOptions; _poolGroup = connection.PoolGroup; if (DbConnectionClosedNeverOpened.SingletonInstance == connection._innerConnection) { _innerConnection = DbConnectionClosedNeverOpened.SingletonInstance; } else { _innerConnection = DbConnectionClosedPreviouslyOpened.SingletonInstance; } }
public override object this[string keyword] { get { ADP.CheckArgumentNull(keyword, "keyword"); Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { return(GetAt(index)); } else { return(base[keyword]); } } set { ADP.CheckArgumentNull(keyword, "keyword"); if (null != value) { Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { switch (index) { case Keywords.Driver: Driver = ConvertToString(value); break; case Keywords.Dsn: Dsn = ConvertToString(value); break; // case Keywords.NamedConnection: NamedConnection = ConvertToString(value); break; default: Debug.Assert(false, "unexpected keyword"); throw ADP.KeywordNotSupported(keyword); } } else { base[keyword] = value; ClearPropertyDescriptors(); _knownKeywords = null; } } else { Remove(keyword); } } }
public void Send(SqlDataReader reader) { ADP.CheckArgumentNull(reader, "reader"); this.SetPipeBusy(); try { this.EnsureNormalSendValid("Send"); do { SmiExtendedMetaData[] internalSmiMetaData = reader.GetInternalSmiMetaData(); if ((internalSmiMetaData != null) && (internalSmiMetaData.Length != 0)) { using (SmiRecordBuffer buffer = this._smiContext.CreateRecordBuffer(internalSmiMetaData, this._eventSink)) { this._eventSink.ProcessMessagesAndThrow(); this._smiContext.SendResultsStartToPipe(buffer, this._eventSink); this._eventSink.ProcessMessagesAndThrow(); try { while (reader.Read()) { if (SmiContextFactory.Instance.NegotiatedSmiVersion >= 210L) { ValueUtilsSmi.FillCompatibleSettersFromReader(this._eventSink, buffer, new List <SmiExtendedMetaData>(internalSmiMetaData), reader); } else { ValueUtilsSmi.FillCompatibleITypedSettersFromReader(this._eventSink, buffer, internalSmiMetaData, reader); } this._smiContext.SendResultsRowToPipe(buffer, this._eventSink); this._eventSink.ProcessMessagesAndThrow(); } } finally { this._smiContext.SendResultsEndToPipe(buffer, this._eventSink); this._eventSink.ProcessMessagesAndThrow(); } } } }while (reader.NextResult()); } finally { this.ClearPipeBusy(); } }
public override bool Remove(string keyword) { ADP.CheckArgumentNull(keyword, "keyword"); bool value = base.Remove(keyword); Keywords index; if (s_keywords.TryGetValue(keyword, out index)) { Reset(index); } else if (value) { ClearPropertyDescriptors(); } return(value); }
// Copy Constructor private void CopyFrom(OleDbConnection connection) { // V1.2.3300 ADP.CheckArgumentNull(connection, "connection"); _userConnectionOptions = connection.UserConnectionOptions; _poolGroup = connection.PoolGroup; // Match the original connection's behavior for whether the connection was never opened, // but ensure Clone is in the closed state. if (DbConnectionClosedNeverOpened.SingletonInstance == connection._innerConnection) { _innerConnection = DbConnectionClosedNeverOpened.SingletonInstance; } else { _innerConnection = DbConnectionClosedPreviouslyOpened.SingletonInstance; } }