3
3
using System . Data . Common ;
4
4
using System . Text ;
5
5
using NHibernate . Dialect . Function ;
6
- using NHibernate . Dialect . Schema ;
6
+ using NHibernate . Dialect . Schema ;
7
+ using NHibernate . Mapping ;
7
8
using NHibernate . SqlCommand ;
8
9
using NHibernate . SqlTypes ;
9
10
using NHibernate . Util ;
@@ -272,15 +273,27 @@ protected virtual void RegisterCastTypes()
272
273
}
273
274
274
275
/// <summary>
275
- /// Suclasses register a typename for the given type code, to be used in CAST()
276
+ /// Subclasses register a typename for the given type code, to be used in CAST()
276
277
/// statements.
277
278
/// </summary>
278
279
/// <param name="code">The typecode</param>
279
280
/// <param name="name">The database type name</param>
280
281
protected void RegisterCastType ( DbType code , string name )
281
282
{
282
283
castTypeNames . Put ( code , name ) ;
283
- }
284
+ }
285
+
286
+ /// <summary>
287
+ /// Subclasses register a typename for the given type code, to be used in CAST()
288
+ /// statements.
289
+ /// </summary>
290
+ /// <param name="code">The typecode</param>
291
+ /// <param name="capacity"></param>
292
+ /// <param name="name">The database type name</param>
293
+ protected void RegisterCastType ( DbType code , int capacity , string name )
294
+ {
295
+ castTypeNames . Put ( code , capacity , name ) ;
296
+ }
284
297
285
298
/// <summary>
286
299
/// Get the name of the database type appropriate for casting operations
@@ -289,8 +302,8 @@ protected void RegisterCastType(DbType code, string name)
289
302
/// <param name="sqlType">The <see cref="SqlType"/> typecode </param>
290
303
/// <returns> The database type name </returns>
291
304
public override string GetCastTypeName ( SqlType sqlType )
292
- {
293
- string result = castTypeNames . Get ( sqlType . DbType ) ;
305
+ {
306
+ string result = castTypeNames . Get ( sqlType . DbType , Column . DefaultLength , Column . DefaultPrecision , Column . DefaultScale ) ;
294
307
if ( result == null )
295
308
{
296
309
throw new HibernateException ( string . Format ( "No CAST() type mapping for SqlType {0}" , sqlType ) ) ;
0 commit comments