Revision: 4430
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4430&view=rev
Author: darioquintana
Date: 2009-06-09 01:23:41 +0000 (Tue, 09 Jun 2009)
Log Message:
-----------
Minor:
- Adding class into a explicit namespace.
- Making the SQLExceptionConversion pass to all PostgreSQL Dialects
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs 2009-06-08 23:12:35 UTC (rev 4429)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs 2009-06-09 01:23:41 UTC (rev 4430)
@@ -2,28 +2,31 @@
using System.Data.Common;
using NHibernate.Exceptions;
-public class PostgresExceptionConverterExample : ISQLExceptionConverter
+namespace NHibernate.Test.ExceptionsTest
{
- #region ISQLExceptionConverter Members
+ public class PostgresExceptionConverterExample : ISQLExceptionConverter
+ {
+ #region ISQLExceptionConverter Members
- public Exception Convert(AdoExceptionContextInfo exInfo)
- {
- var sqle = ADOExceptionHelper.ExtractDbException(exInfo.SqlException) as DbException;
- if (sqle != null)
+ public Exception Convert(AdoExceptionContextInfo exInfo)
{
- string code = (string) sqle.GetType().GetProperty("Code").GetValue(sqle, null);
+ var sqle = ADOExceptionHelper.ExtractDbException(exInfo.SqlException) as DbException;
+ if (sqle != null)
+ {
+ string code = (string)sqle.GetType().GetProperty("Code").GetValue(sqle, null);
- if (code == "23503")
- {
- return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);
+ if (code == "23503")
+ {
+ return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);
+ }
+ if (code == "42P01")
+ {
+ return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);
+ }
}
- if (code == "42P01")
- {
- return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);
- }
+ return SQLStateConverter.HandledNonSpecificException(exInfo.SqlException, exInfo.Message, exInfo.Sql);
}
- return SQLStateConverter.HandledNonSpecificException(exInfo.SqlException, exInfo.Message, exInfo.Sql);
+
+ #endregion
}
-
- #endregion
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-06-08 23:12:35 UTC (rev 4429)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-06-09 01:23:41 UTC (rev 4430)
@@ -34,7 +34,7 @@
typeof(OracleClientExceptionConverterExample).AssemblyQualifiedName);
}
- if (Dialect is PostgreSQL82Dialect)
+ if (Dialect is PostgreSQLDialect)
{
configuration.SetProperty(Cfg.Environment.SqlExceptionConverter,
typeof(PostgresExceptionConverterExample).AssemblyQualifiedName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|