blob: 18da7f1535441a0c73c02f9bc0f7fc18bbe6914b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
//------------------------------------------------------------------------------
// <copyright file="TdsParameterSetter.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
// <owner current="true" primary="false">Microsoft</owner>
// <owner current="true" primary="false">Microsoft</owner>
//------------------------------------------------------------------------------
namespace System.Data.SqlClient {
using System;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using Microsoft.SqlServer.Server;
// Simple Getter/Setter for structured parameters to allow using common ValueUtilsSmi code.
// This is a stand-in to having a true SmiRequestExecutor class for TDS.
internal class TdsParameterSetter : SmiTypedGetterSetter {
#region Private fields
private TdsRecordBufferSetter _target;
#endregion
#region ctor & control
internal TdsParameterSetter(TdsParserStateObject stateObj, SmiMetaData md) {
_target = new TdsRecordBufferSetter(stateObj, md);
}
#endregion
#region TypedGetterSetter overrides
// Are calls to Get methods allowed?
internal override bool CanGet {
get {
return false;
}
}
// Are calls to Set methods allowed?
internal override bool CanSet {
get {
return true;
}
}
// valid for structured types
// This method called for both get and set.
internal override SmiTypedGetterSetter GetTypedGetterSetter(SmiEventSink sink, int ordinal) {
Debug.Assert(0==ordinal, "TdsParameterSetter only supports 0 for ordinal. Actual = " + ordinal);
return _target;
}
// Set value to null
// valid for all types
public override void SetDBNull(SmiEventSink sink, int ordinal) {
Debug.Assert(0==ordinal, "TdsParameterSetter only supports 0 for ordinal. Actual = " + ordinal);
_target.EndElements(sink);
}
#endregion
}
}
|