Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21725/src/NHibernate/Id
Modified Files:
TableGenerator.cs
Log Message:
* Better SQLite support - only about 20 test cases fail on SQLite, mostly due to bugs in SQLite ADO.NET provider
* Modified TestCase to clean up unclosed sessions in TearDown - not completely bullet-proof, since some tests don't call TearDown, but covers a lot of the cases.
* Changed sessions.OpenSession() to OpenSession() in all tests
* Added Dialect.SupportsSubSelects property for use in tests instead of (dialect is SomeDialect) expressions.
Index: TableGenerator.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/TableGenerator.cs,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** TableGenerator.cs 14 Mar 2005 22:41:16 -0000 1.17
--- TableGenerator.cs 5 May 2005 19:28:22 -0000 1.18
***************
*** 113,125 ****
public virtual object Generate( ISessionImplementor session, object obj )
{
! //this has to be done using a different connection to the containing
! //transaction becase the new hi value must remain valid even if the
! //contataining transaction rolls back
! IDbConnection conn = session.Factory.OpenConnection();
int result;
int rows;
try
{
! IDbTransaction trans = conn.BeginTransaction();
do
--- 113,143 ----
public virtual object Generate( ISessionImplementor session, object obj )
{
! // This has to be done using a different connection to the containing
! // transaction becase the new hi value must remain valid even if the
! // containing transaction rolls back.
! //
! // We make an exception for SQLite and use the session's connection,
! // since SQLite only allows one connection to the database.
!
! bool isSQLite = session.Factory.Dialect is Dialect.SQLiteDialect;
! IDbConnection conn;
! if( isSQLite )
! {
! conn = session.Connection;
! }
! else
! {
! conn = session.Factory.OpenConnection();
! }
!
int result;
int rows;
try
{
! IDbTransaction trans = null;
! if( !isSQLite )
! {
! trans = conn.BeginTransaction();
! }
do
***************
*** 182,186 ****
while( rows == 0 );
! trans.Commit();
return result;
--- 200,207 ----
while( rows == 0 );
! if( !isSQLite )
! {
! trans.Commit();
! }
return result;
***************
*** 189,193 ****
finally
{
! session.Factory.CloseConnection( conn );
}
}
--- 210,217 ----
finally
{
! if( !isSQLite )
! {
! session.Factory.CloseConnection( conn );
! }
}
}
|