internal override void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter paramValue, int ordinal) { if (this._parent == null) { throw SQL.UnexpectedSmiEvent(UnexpectedEventType.ParameterAvailable); } this._parent.ParameterAvailable(metaData, paramValue, ordinal); }
// Called zero or one time when output parameters are available (errors could prevent event from occuring) internal virtual void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter paramValue, int ordinal) { // Adding as of V200 // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V3- and hasn't implemented V200 yet. // 2) Server didn't implement V200 on some interface, but negotiated V200+. System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod ); }
// Called zero or one time when output parameters are available (errors could prevent event from occuring) internal virtual void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter paramValue, int ordinal) { // Adding as of V200 // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V3- and hasn't implemented V200 yet. // 2) Server didn't implement V200 on some interface, but negotiated V200+. System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); }
internal abstract SmiRequestExecutor CreateRequestExecutor ( string commandText, CommandType commandType, SmiParameterMetaData[] parameterMetaData, SmiEventSink eventSink );
// Called zero or one time when output parameters are available (errors could prevent event from occuring) internal virtual void ParametersAvailable( SmiParameterMetaData[] metaData, ITypedGettersV3 paramValues ) { // Adding as of V3 // Obsoleting as of V200 // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V200+ and dropped support for V200-. // 2) Server didn't implement V3- on some interface and negotiated V3-. System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod ); }
/// <summary> /// Constructor. /// </summary> /// <param name="smiParameterMetadata"></param> /// <param name="cipherMetadata"></param> internal SqlColumnEncryptionInputParameterInfo(SmiParameterMetaData smiParameterMetadata, SqlCipherMetadata cipherMetadata) { Debug.Assert(smiParameterMetadata != null, "smiParameterMetadata should not be null."); Debug.Assert(cipherMetadata != null, "cipherMetadata should not be null"); Debug.Assert(cipherMetadata.EncryptionKeyInfo.HasValue, "cipherMetadata.EncryptionKeyInfo.HasValue should be true."); _smiParameterMetadata = smiParameterMetadata; _cipherMetadata = cipherMetadata; _serializedWireFormat = SerializeToWriteFormat(); }
internal override void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter parameterValues, int ordinal) { if (Bid.AdvancedOn && (metaData != null)) { Bid.Trace("<sc.SqlCommand.CommandEventSink.ParameterAvailable|ADV> %d#, metaData[%d] is %ls%ls\n", this._command.ObjectID, ordinal, metaData.GetType().ToString(), metaData.TraceString()); } this._command.OnParameterAvailableSmi(metaData, parameterValues, ordinal); }
internal virtual void ParametersAvailable(SmiParameterMetaData[] metaData, ITypedGettersV3 paramValues) { ADP.InternalError(ADP.InternalErrorCode.UnimplementedSMIMethod); }
internal void OnParametersAvailableSmi(SmiParameterMetaData[] paramMetaData, ITypedGettersV3 parameterValues) { for (int i = 0; i < paramMetaData.Length; i++) { this.OnParameterAvailableSmi(paramMetaData[i], parameterValues, i); } }
private void SetUpSmiRequest(SqlInternalConnectionSmi innerConnection) { this.DisposeSmiRequest(); if (this.Notification != null) { throw SQL.NotificationsNotAvailableOnContextConnection(); } SmiParameterMetaData[] parameterMetaData = null; ParameterPeekAheadValue[] valueArray = null; int parameterCount = this.GetParameterCount(this.Parameters); if (0 < parameterCount) { parameterMetaData = new SmiParameterMetaData[parameterCount]; valueArray = new ParameterPeekAheadValue[parameterCount]; for (int j = 0; j < parameterCount; j++) { SqlParameter parameter2 = this.Parameters[j]; parameter2.Validate(j, System.Data.CommandType.StoredProcedure == this.CommandType); parameterMetaData[j] = parameter2.MetaDataForSmi(out valueArray[j]); if (!innerConnection.IsKatmaiOrNewer) { MetaType metaTypeFromSqlDbType = MetaType.GetMetaTypeFromSqlDbType(parameterMetaData[j].SqlDbType, parameterMetaData[j].IsMultiValued); if (!metaTypeFromSqlDbType.Is90Supported) { throw ADP.VersionDoesNotSupportDataType(metaTypeFromSqlDbType.TypeName); } } } } System.Data.CommandType commandType = this.CommandType; this._smiRequestContext = innerConnection.InternalContext; this._smiRequest = this._smiRequestContext.CreateRequestExecutor(this.CommandText, commandType, parameterMetaData, this.EventSink); this.EventSink.ProcessMessagesAndThrow(); for (int i = 0; i < parameterCount; i++) { if ((ParameterDirection.Output == parameterMetaData[i].Direction) || (ParameterDirection.ReturnValue == parameterMetaData[i].Direction)) { continue; } SqlParameter parameter = this.Parameters[i]; object coercedValue = parameter.GetCoercedValue(); ExtendedClrTypeCode typeCode = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType(parameterMetaData[i].SqlDbType, parameterMetaData[i].IsMultiValued, coercedValue, null, SmiContextFactory.Instance.NegotiatedSmiVersion); if ((System.Data.CommandType.StoredProcedure == commandType) && (ExtendedClrTypeCode.Empty == typeCode)) { this._smiRequest.SetDefault(i); continue; } int size = parameter.Size; if (((size != 0) && (size != -1L)) && !parameter.SizeInferred) { switch (parameterMetaData[i].SqlDbType) { case SqlDbType.NText: if (size != 0x3fffffff) { throw SQL.ParameterSizeRestrictionFailure(i); } break; case SqlDbType.NVarChar: if (((size > 0) && (size != 0x3fffffff)) && (parameterMetaData[i].MaxLength == -1L)) { throw SQL.ParameterSizeRestrictionFailure(i); } break; case SqlDbType.Text: case SqlDbType.Image: goto Label_01E8; case SqlDbType.Timestamp: if (size < SmiMetaData.DefaultTimestamp.MaxLength) { throw SQL.ParameterSizeRestrictionFailure(i); } break; case SqlDbType.VarBinary: case SqlDbType.VarChar: goto Label_020C; case SqlDbType.Variant: goto Label_0271; case SqlDbType.Xml: if ((coercedValue != null) && (ExtendedClrTypeCode.SqlXml != typeCode)) { throw SQL.ParameterSizeRestrictionFailure(i); } break; } } goto Label_02CF; Label_01E8: if (size == 0x7fffffff) { goto Label_02CF; } throw SQL.ParameterSizeRestrictionFailure(i); Label_020C: if (((size <= 0) || (size == 0x7fffffff)) || (parameterMetaData[i].MaxLength != -1L)) { goto Label_02CF; } throw SQL.ParameterSizeRestrictionFailure(i); Label_0271: if (coercedValue != null) { MetaType metaTypeFromValue = MetaType.GetMetaTypeFromValue(coercedValue); if (((metaTypeFromValue.IsNCharType && (size < 0xfa0L)) || (metaTypeFromValue.IsBinType && (size < 0x1f40L))) || (metaTypeFromValue.IsAnsiType && (size < 0x1f40L))) { throw SQL.ParameterSizeRestrictionFailure(i); } } Label_02CF: if (innerConnection.IsKatmaiOrNewer) { ValueUtilsSmi.SetCompatibleValueV200(this.EventSink, this._smiRequest, i, parameterMetaData[i], coercedValue, typeCode, parameter.Offset, parameter.Size, valueArray[i]); } else { ValueUtilsSmi.SetCompatibleValue(this.EventSink, this._smiRequest, i, parameterMetaData[i], coercedValue, typeCode, parameter.Offset); } } }
internal void OnParameterAvailableSmi(SmiParameterMetaData metaData, ITypedGettersV3 parameterValues, int ordinal) { if (ParameterDirection.Input != metaData.Direction) { string paramName = null; if (ParameterDirection.ReturnValue != metaData.Direction) { paramName = metaData.Name; } SqlParameterCollection currentParameterCollection = this.GetCurrentParameterCollection(); int parameterCount = this.GetParameterCount(currentParameterCollection); SqlParameter parameter = this.GetParameterForOutputValueExtraction(currentParameterCollection, paramName, parameterCount); if (parameter != null) { object obj2; parameter.LocaleId = (int) metaData.LocaleId; parameter.CompareInfo = metaData.CompareOptions; SqlBuffer targetBuffer = new SqlBuffer(); if (this._activeConnection.IsKatmaiOrNewer) { obj2 = ValueUtilsSmi.GetOutputParameterV200Smi(this.OutParamEventSink, (SmiTypedGetterSetter) parameterValues, ordinal, metaData, this._smiRequestContext, targetBuffer); } else { obj2 = ValueUtilsSmi.GetOutputParameterV3Smi(this.OutParamEventSink, parameterValues, ordinal, metaData, this._smiRequestContext, targetBuffer); } if (obj2 != null) { parameter.Value = obj2; } else { parameter.SetSqlBuffer(targetBuffer); } } } }
internal virtual void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter paramValue, int ordinal) { ADP.InternalError(ADP.InternalErrorCode.UnimplementedSMIMethod); }
private void WriteSmiParameterMetaData(SmiParameterMetaData metaData, bool sendDefault, TdsParserStateObject stateObj) { byte b = 0; if ((ParameterDirection.Output == metaData.Direction) || (ParameterDirection.InputOutput == metaData.Direction)) { b = (byte) (b | 1); } if (sendDefault) { b = (byte) (b | 2); } this.WriteParameterName(metaData.Name, stateObj); this.WriteByte(b, stateObj); this.WriteSmiTypeInfo(metaData, stateObj); }
internal override void ParametersAvailable(SmiParameterMetaData[] metaData, ITypedGettersV3 paramValues) { if (null == _parent) { throw SQL.UnexpectedSmiEvent(UnexpectedEventType.ParametersAvailable); } _parent.ParametersAvailable(metaData, paramValues); }
internal override void ParametersAvailable(SmiParameterMetaData[] metaData, ITypedGettersV3 parameterValues) { if (Bid.AdvancedOn) { Bid.Trace("<sc.SqlCommand.CommandEventSink.ParametersAvailable|ADV> %d# metaData.Length=%d.\n", this._command.ObjectID, (metaData != null) ? metaData.Length : -1); if (metaData != null) { for (int i = 0; i < metaData.Length; i++) { Bid.Trace("<sc.SqlCommand.CommandEventSink.ParametersAvailable|ADV> %d#, metaData[%d] is %ls%ls\n", this._command.ObjectID, i, metaData[i].GetType().ToString(), metaData[i].TraceString()); } } } this._command.OnParametersAvailableSmi(metaData, parameterValues); }
internal override void ParameterAvailable(SmiParameterMetaData metaData, SmiTypedGetterSetter paramValue, int ordinal) { if (null == _parent) { throw SQL.UnexpectedSmiEvent(UnexpectedEventType.ParameterAvailable); } _parent.ParameterAvailable(metaData, paramValue, ordinal); }