33using System . Data . Common ;
44using System . Text ;
55using NHibernate . Dialect . Function ;
6- using NHibernate . Dialect . Schema ;
6+ using NHibernate . Dialect . Schema ;
7+ using NHibernate . Mapping ;
78using NHibernate . SqlCommand ;
89using NHibernate . SqlTypes ;
910using NHibernate . Util ;
@@ -272,15 +273,27 @@ protected virtual void RegisterCastTypes()
272273 }
273274
274275 /// <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()
276277 /// statements.
277278 /// </summary>
278279 /// <param name="code">The typecode</param>
279280 /// <param name="name">The database type name</param>
280281 protected void RegisterCastType ( DbType code , string name )
281282 {
282283 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+ }
284297
285298 /// <summary>
286299 /// Get the name of the database type appropriate for casting operations
@@ -289,8 +302,8 @@ protected void RegisterCastType(DbType code, string name)
289302 /// <param name="sqlType">The <see cref="SqlType"/> typecode </param>
290303 /// <returns> The database type name </returns>
291304 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 ) ;
294307 if ( result == null )
295308 {
296309 throw new HibernateException ( string . Format ( "No CAST() type mapping for SqlType {0}" , sqlType ) ) ;
0 commit comments