6
6
using System . Data . SqlClient ;
7
7
#endif
8
8
using NHibernate . AdoNet ;
9
+ using NHibernate . Dialect ;
9
10
using NHibernate . Engine ;
10
11
using NHibernate . SqlTypes ;
11
12
@@ -21,21 +22,41 @@ public class SqlClientDriver
21
22
: ReflectionBasedDriver , IEmbeddedBatcherFactoryProvider
22
23
#endif
23
24
{
25
+ // Since v5.1
26
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForAnsiClob" ) ]
24
27
public const int MaxSizeForAnsiClob = 2147483647 ; // int.MaxValue
28
+ // Since v5.1
29
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForClob" ) ]
25
30
public const int MaxSizeForClob = 1073741823 ; // int.MaxValue / 2
31
+ // Since v5.1
32
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForBlob" ) ]
26
33
public const int MaxSizeForBlob = 2147483647 ; // int.MaxValue
27
- //http://stackoverflow.com/a/7264795/259946
34
+
35
+ ///<remarks>http://stackoverflow.com/a/7264795/259946</remarks>
36
+ // Since v5.1
37
+ [ Obsolete ( "Use MsSql2005Dialect.MaxSizeForXml" ) ]
28
38
public const int MaxSizeForXml = 2147483647 ; // int.MaxValue
39
+
40
+ // Since v5.1
41
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForLengthLimitedAnsiString" ) ]
29
42
public const int MaxSizeForLengthLimitedAnsiString = 8000 ;
43
+ // Since v5.1
44
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForLengthLimitedString" ) ]
30
45
public const int MaxSizeForLengthLimitedString = 4000 ;
46
+ // Since v5.1
47
+ [ Obsolete ( "Use MsSql2000Dialect.MaxSizeForLengthLimitedBinary" ) ]
31
48
public const int MaxSizeForLengthLimitedBinary = 8000 ;
32
49
// Since v5.1
33
50
[ Obsolete ( "This member has no more usages and will be removed in a future version" ) ]
34
51
public const byte MaxPrecision = 28 ;
35
52
// Since v5.1
36
53
[ Obsolete ( "This member has no more usages and will be removed in a future version" ) ]
37
54
public const byte MaxScale = 5 ;
55
+ // Since v5.1
56
+ [ Obsolete ( "Use MsSql2000Dialect.MaxDateTime2" ) ]
38
57
public const byte MaxDateTime2 = 8 ;
58
+ // Since v5.1
59
+ [ Obsolete ( "Use MsSql2000Dialect.MaxDateTimeOffset" ) ]
39
60
public const byte MaxDateTimeOffset = 10 ;
40
61
41
62
private Dialect . Dialect _dialect ;
@@ -139,10 +160,10 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq
139
160
{
140
161
case DbType . AnsiString :
141
162
case DbType . AnsiStringFixedLength :
142
- dbParam . Size = IsAnsiText ( dbParam , sqlType ) ? MaxSizeForAnsiClob : MaxSizeForLengthLimitedAnsiString ;
163
+ dbParam . Size = IsAnsiText ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForAnsiClob : MsSql2000Dialect . MaxSizeForLengthLimitedAnsiString ;
143
164
break ;
144
165
case DbType . Binary :
145
- dbParam . Size = IsBlob ( dbParam , sqlType ) ? MaxSizeForBlob : MaxSizeForLengthLimitedBinary ;
166
+ dbParam . Size = IsBlob ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForBlob : MsSql2000Dialect . MaxSizeForLengthLimitedBinary ;
146
167
break ;
147
168
case DbType . Decimal :
148
169
if ( _dialect == null )
@@ -152,16 +173,16 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq
152
173
break ;
153
174
case DbType . String :
154
175
case DbType . StringFixedLength :
155
- dbParam . Size = IsText ( dbParam , sqlType ) ? MaxSizeForClob : MaxSizeForLengthLimitedString ;
176
+ dbParam . Size = IsText ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForClob : MsSql2000Dialect . MaxSizeForLengthLimitedString ;
156
177
break ;
157
178
case DbType . DateTime2 :
158
- dbParam . Size = MaxDateTime2 ;
179
+ dbParam . Size = MsSql2000Dialect . MaxDateTime2 ;
159
180
break ;
160
181
case DbType . DateTimeOffset :
161
- dbParam . Size = MaxDateTimeOffset ;
182
+ dbParam . Size = MsSql2000Dialect . MaxDateTimeOffset ;
162
183
break ;
163
184
case DbType . Xml :
164
- dbParam . Size = MaxSizeForXml ;
185
+ dbParam . Size = MsSql2005Dialect . MaxSizeForXml ;
165
186
break ;
166
187
}
167
188
@@ -203,27 +224,27 @@ protected static void SetDefaultParameterSize(DbParameter dbParam, SqlType sqlTy
203
224
{
204
225
case DbType . AnsiString :
205
226
case DbType . AnsiStringFixedLength :
206
- dbParam . Size = IsAnsiText ( dbParam , sqlType ) ? MaxSizeForAnsiClob : MaxSizeForLengthLimitedAnsiString ;
227
+ dbParam . Size = IsAnsiText ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForAnsiClob : MsSql2000Dialect . MaxSizeForLengthLimitedAnsiString ;
207
228
break ;
208
229
case DbType . Binary :
209
- dbParam . Size = IsBlob ( dbParam , sqlType ) ? MaxSizeForBlob : MaxSizeForLengthLimitedBinary ;
230
+ dbParam . Size = IsBlob ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForBlob : MsSql2000Dialect . MaxSizeForLengthLimitedBinary ;
210
231
break ;
211
232
case DbType . Decimal :
212
233
dbParam . Precision = MaxPrecision ;
213
234
dbParam . Scale = MaxScale ;
214
235
break ;
215
236
case DbType . String :
216
237
case DbType . StringFixedLength :
217
- dbParam . Size = IsText ( dbParam , sqlType ) ? MaxSizeForClob : MaxSizeForLengthLimitedString ;
238
+ dbParam . Size = IsText ( dbParam , sqlType ) ? MsSql2000Dialect . MaxSizeForClob : MsSql2000Dialect . MaxSizeForLengthLimitedString ;
218
239
break ;
219
240
case DbType . DateTime2 :
220
- dbParam . Size = MaxDateTime2 ;
241
+ dbParam . Size = MsSql2000Dialect . MaxDateTime2 ;
221
242
break ;
222
243
case DbType . DateTimeOffset :
223
- dbParam . Size = MaxDateTimeOffset ;
244
+ dbParam . Size = MsSql2000Dialect . MaxDateTimeOffset ;
224
245
break ;
225
246
case DbType . Xml :
226
- dbParam . Size = MaxSizeForXml ;
247
+ dbParam . Size = MsSql2005Dialect . MaxSizeForXml ;
227
248
break ;
228
249
}
229
250
}
@@ -236,7 +257,7 @@ protected static void SetDefaultParameterSize(DbParameter dbParam, SqlType sqlTy
236
257
/// <returns>True, if the parameter should be interpreted as a Clob, otherwise False</returns>
237
258
protected static bool IsAnsiText ( DbParameter dbParam , SqlType sqlType )
238
259
{
239
- return ( ( DbType . AnsiString == dbParam . DbType || DbType . AnsiStringFixedLength == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MaxSizeForLengthLimitedAnsiString ) ) ;
260
+ return ( ( DbType . AnsiString == dbParam . DbType || DbType . AnsiStringFixedLength == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MsSql2000Dialect . MaxSizeForLengthLimitedAnsiString ) ) ;
240
261
}
241
262
242
263
/// <summary>
@@ -247,7 +268,7 @@ protected static bool IsAnsiText(DbParameter dbParam, SqlType sqlType)
247
268
/// <returns>True, if the parameter should be interpreted as a Clob, otherwise False</returns>
248
269
protected static bool IsText ( DbParameter dbParam , SqlType sqlType )
249
270
{
250
- return ( sqlType is StringClobSqlType ) || ( ( DbType . String == dbParam . DbType || DbType . StringFixedLength == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MaxSizeForLengthLimitedString ) ) ;
271
+ return ( sqlType is StringClobSqlType ) || ( ( DbType . String == dbParam . DbType || DbType . StringFixedLength == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MsSql2000Dialect . MaxSizeForLengthLimitedString ) ) ;
251
272
}
252
273
253
274
/// <summary>
@@ -258,7 +279,7 @@ protected static bool IsText(DbParameter dbParam, SqlType sqlType)
258
279
/// <returns>True, if the parameter should be interpreted as a Blob, otherwise False</returns>
259
280
protected static bool IsBlob ( DbParameter dbParam , SqlType sqlType )
260
281
{
261
- return ( sqlType is BinaryBlobSqlType ) || ( ( DbType . Binary == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MaxSizeForLengthLimitedBinary ) ) ;
282
+ return ( sqlType is BinaryBlobSqlType ) || ( ( DbType . Binary == dbParam . DbType ) && sqlType . LengthDefined && ( sqlType . Length > MsSql2000Dialect . MaxSizeForLengthLimitedBinary ) ) ;
262
283
}
263
284
264
285
0 commit comments