Skip to content

Commit 121a875

Browse files
committed
Clear query cache
1 parent 1226f6d commit 121a875

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/NHibernate.Test/TestCase.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
using NUnit.Framework.Interfaces;
1515
using System.Text;
1616
using NHibernate.Driver;
17+
using NHibernate.SqlCommand;
18+
using NHibernate.SqlTypes;
1719

1820
namespace NHibernate.Test
1921
{
@@ -297,13 +299,16 @@ public static void DropSchema(bool useStdOut, SchemaExport export, ISessionFacto
297299
// As it seems Oracle can cache returned types for query for given connection.
298300
// So exception can be thrown if two tests execute same query but with different types in result (like for Entity.Id int and Entity.Id Guid)
299301
case OracleClientDriver oraSysData:
300-
oraSysData.ClearPool(null);
301-
break;
302302
case OracleDataClientDriver oraUnmanaged:
303-
oraUnmanaged.ClearPool(null);
304-
break;
305303
case OracleManagedDataClientDriver oraManaged:
306-
oraManaged.ClearPool(null);
304+
using (var con = sfi.ConnectionProvider.GetConnection())
305+
using (var cmd = con.CreateCommand())
306+
{
307+
cmd.CommandText = "alter system flush shared_pool;";
308+
cmd.Connection = con;
309+
cmd.ExecuteNonQuery();
310+
}
311+
307312
break;
308313

309314
// Firebird will pool each connection created during the test and will marked as used any table

0 commit comments

Comments
 (0)