|
From: <fab...@us...> - 2009-02-02 22:16:29
|
Revision: 4013
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4013&view=rev
Author: fabiomaulo
Date: 2009-02-02 21:33:58 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
- New Oracle dialects
- Updated ignore list in some tests
NOTE : Old Oracle dialects will be removed in a future NH version.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/OracleDialect.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/Cascade/RefreshFixture.cs
trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1521/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/DoubleTypeFixture.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Dialect/Oracle10gDialect.cs
trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs
trunk/nhibernate/src/NHibernate/Dialect/Oracle9iDialect.cs
Added: trunk/nhibernate/src/NHibernate/Dialect/Oracle10gDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Oracle10gDialect.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Dialect/Oracle10gDialect.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -0,0 +1,19 @@
+using NHibernate.SqlCommand;
+
+namespace NHibernate.Dialect
+{
+ /// <summary>
+ /// A dialect specifically for use with Oracle 10g.
+ /// </summary>
+ /// <remarks>
+ /// The main difference between this dialect and <see cref="Oracle9iDialect"/>
+ /// is the use of "ANSI join syntax" here...
+ /// </remarks>
+ public class Oracle10gDialect : Oracle9iDialect
+ {
+ public override JoinFragment CreateOuterJoinFragment()
+ {
+ return new ANSIJoinFragment();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -0,0 +1,487 @@
+using System;
+using System.Collections;
+using System.Data;
+using NHibernate.Dialect.Function;
+using NHibernate.Engine;
+using NHibernate.SqlCommand;
+using NHibernate.SqlTypes;
+using NHibernate.Type;
+using Environment=NHibernate.Cfg.Environment;
+
+namespace NHibernate.Dialect
+{
+ /// <summary>
+ /// A dialect for Oracle 8i.
+ /// </summary>
+ public class Oracle8iDialect : Dialect
+ {
+ public override string CurrentTimestampSelectString
+ {
+ get { return "select sysdate from dual"; }
+ }
+
+ public override string CurrentTimestampSQLFunctionName
+ {
+ get { return "sysdate"; }
+ }
+
+ public override string AddColumnString
+ {
+ get { return "add"; }
+ }
+
+ public override string CascadeConstraintsString
+ {
+ get { return " cascade constraints"; }
+ }
+
+ public override string QuerySequencesString
+ {
+ get { return "select sequence_name from user_sequences"; }
+ }
+
+ public override string SelectGUIDString
+ {
+ get { return "select rawtohex(sys_guid()) from dual"; }
+ }
+
+ public override string CreateTemporaryTableString
+ {
+ get { return "create global temporary table"; }
+ }
+
+ public override string CreateTemporaryTablePostfix
+ {
+ get { return "on commit delete rows"; }
+ }
+
+ public override bool IsCurrentTimestampSelectStringCallable
+ {
+ get { return false; }
+ }
+
+ public Oracle8iDialect()
+ {
+ RegisterCharacterTypeMappings();
+ RegisterNumericTypeMappings();
+ RegisterDateTimeTypeMappings();
+ RegisterLargeObjectTypeMappings();
+
+ RegisterReverseHibernateTypeMappings();
+
+ RegisterFunctions();
+
+ RegisterDefaultProperties();
+ }
+
+ protected virtual void RegisterCharacterTypeMappings()
+ {
+ RegisterColumnType(DbType.AnsiStringFixedLength, "CHAR(255)");
+ RegisterColumnType(DbType.AnsiStringFixedLength, 2000, "CHAR($l)");
+ RegisterColumnType(DbType.AnsiString, "VARCHAR2(255)");
+ RegisterColumnType(DbType.AnsiString, 4000, "VARCHAR2($l)");
+ RegisterColumnType(DbType.StringFixedLength, "NCHAR(255)");
+ RegisterColumnType(DbType.StringFixedLength, 2000, "NCHAR($l)");
+ RegisterColumnType(DbType.String, "NVARCHAR2(255)");
+ RegisterColumnType(DbType.String, 4000, "NVARCHAR2($l)");
+ }
+
+ protected virtual void RegisterNumericTypeMappings()
+ {
+ RegisterColumnType(DbType.Boolean, "NUMBER(1,0)");
+ RegisterColumnType(DbType.Byte, "NUMBER(3,0)");
+ RegisterColumnType(DbType.Int16, "NUMBER(5,0)");
+ RegisterColumnType(DbType.Int32, "NUMBER(10,0)");
+ RegisterColumnType(DbType.Int64, "NUMBER(20,0)");
+ RegisterColumnType(DbType.UInt16, "NUMBER(5,0)");
+ RegisterColumnType(DbType.UInt32, "NUMBER(10,0)");
+ RegisterColumnType(DbType.UInt64, "NUMBER(20,0)");
+
+ RegisterColumnType(DbType.Currency, "NUMBER(20,2)");
+ RegisterColumnType(DbType.Currency, "NUMBER($p,$s)");
+ RegisterColumnType(DbType.Single, "FLOAT(24)");
+ RegisterColumnType(DbType.Double, "DOUBLE PRECISION");
+ RegisterColumnType(DbType.Double, 19, "NUMBER($p,$s)");
+ RegisterColumnType(DbType.Double, 19, "NUMBER(19, $l)");
+ RegisterColumnType(DbType.Decimal, "NUMBER(19,5)");
+ RegisterColumnType(DbType.Decimal, 19, "NUMBER(19, $l)");
+ RegisterColumnType(DbType.Decimal, 19, "NUMBER($p,$s)");
+ }
+
+ protected virtual void RegisterDateTimeTypeMappings()
+ {
+ RegisterColumnType(DbType.Date, "DATE");
+ RegisterColumnType(DbType.DateTime, "DATE");
+ RegisterColumnType(DbType.Time, "DATE");
+ }
+
+ protected virtual void RegisterLargeObjectTypeMappings()
+ {
+ RegisterColumnType(DbType.Binary, "RAW(2000)");
+ RegisterColumnType(DbType.Binary, 2000, "RAW($l)");
+ RegisterColumnType(DbType.Binary, 2147483647, "BLOB");
+ RegisterColumnType(DbType.AnsiString, 2147483647, "CLOB"); // should use the IType.ClobType
+ RegisterColumnType(DbType.String, 1073741823, "NCLOB");
+ }
+
+ protected virtual void RegisterReverseHibernateTypeMappings() {}
+
+ protected virtual void RegisterFunctions()
+ {
+ RegisterFunction("abs", new StandardSQLFunction("abs"));
+ RegisterFunction("sign", new StandardSQLFunction("sign", NHibernateUtil.Int32));
+
+ RegisterFunction("acos", new StandardSQLFunction("acos", NHibernateUtil.Double));
+ RegisterFunction("asin", new StandardSQLFunction("asin", NHibernateUtil.Double));
+ RegisterFunction("atan", new StandardSQLFunction("atan", NHibernateUtil.Double));
+ RegisterFunction("cos", new StandardSQLFunction("cos", NHibernateUtil.Double));
+ RegisterFunction("cosh", new StandardSQLFunction("cosh", NHibernateUtil.Double));
+ RegisterFunction("exp", new StandardSQLFunction("exp", NHibernateUtil.Double));
+ RegisterFunction("ln", new StandardSQLFunction("ln", NHibernateUtil.Double));
+ RegisterFunction("sin", new StandardSQLFunction("sin", NHibernateUtil.Double));
+ RegisterFunction("sinh", new StandardSQLFunction("sinh", NHibernateUtil.Double));
+ RegisterFunction("stddev", new StandardSQLFunction("stddev", NHibernateUtil.Double));
+ RegisterFunction("sqrt", new StandardSQLFunction("sqrt", NHibernateUtil.Double));
+ RegisterFunction("tan", new StandardSQLFunction("tan", NHibernateUtil.Double));
+ RegisterFunction("tanh", new StandardSQLFunction("tanh", NHibernateUtil.Double));
+ RegisterFunction("variance", new StandardSQLFunction("variance", NHibernateUtil.Double));
+
+ RegisterFunction("round", new StandardSQLFunction("round"));
+ RegisterFunction("trunc", new StandardSQLFunction("trunc"));
+ RegisterFunction("ceil", new StandardSQLFunction("ceil"));
+ RegisterFunction("floor", new StandardSQLFunction("floor"));
+
+ RegisterFunction("chr", new StandardSQLFunction("chr", NHibernateUtil.Character));
+ RegisterFunction("initcap", new StandardSQLFunction("initcap"));
+ RegisterFunction("lower", new StandardSQLFunction("lower"));
+ RegisterFunction("ltrim", new StandardSQLFunction("ltrim"));
+ RegisterFunction("rtrim", new StandardSQLFunction("rtrim"));
+ RegisterFunction("soundex", new StandardSQLFunction("soundex"));
+ RegisterFunction("upper", new StandardSQLFunction("upper"));
+ RegisterFunction("ascii", new StandardSQLFunction("ascii", NHibernateUtil.Int32));
+ RegisterFunction("length", new StandardSQLFunction("length", NHibernateUtil.Int64));
+ RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1, 1, ?2)"));
+ RegisterFunction("right", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1, -?2)"));
+
+ RegisterFunction("to_char", new StandardSQLFunction("to_char", NHibernateUtil.String));
+ RegisterFunction("to_date", new StandardSQLFunction("to_date", NHibernateUtil.Timestamp));
+
+ RegisterFunction("current_date", new NoArgSQLFunction("current_date", NHibernateUtil.Date, false));
+ RegisterFunction("current_time", new NoArgSQLFunction("current_timestamp", NHibernateUtil.Time, false));
+ RegisterFunction("current_timestamp", new CurrentTimeStamp());
+
+ RegisterFunction("last_day", new StandardSQLFunction("last_day", NHibernateUtil.Date));
+ RegisterFunction("sysdate", new NoArgSQLFunction("sysdate", NHibernateUtil.Date, false));
+ RegisterFunction("systimestamp", new NoArgSQLFunction("systimestamp", NHibernateUtil.Timestamp, false));
+ RegisterFunction("uid", new NoArgSQLFunction("uid", NHibernateUtil.Int32, false));
+ RegisterFunction("user", new NoArgSQLFunction("user", NHibernateUtil.String, false));
+
+ RegisterFunction("rowid", new NoArgSQLFunction("rowid", NHibernateUtil.Int64, false));
+ RegisterFunction("rownum", new NoArgSQLFunction("rownum", NHibernateUtil.Int64, false));
+
+ // Multi-param string dialect functions...
+ RegisterFunction("instr", new StandardSQLFunction("instr", NHibernateUtil.Int32));
+ RegisterFunction("instrb", new StandardSQLFunction("instrb", NHibernateUtil.Int32));
+ RegisterFunction("lpad", new StandardSQLFunction("lpad", NHibernateUtil.String));
+ RegisterFunction("replace", new StandardSQLFunction("replace", NHibernateUtil.String));
+ RegisterFunction("rpad", new StandardSQLFunction("rpad", NHibernateUtil.String));
+ RegisterFunction("substr", new StandardSQLFunction("substr", NHibernateUtil.String));
+ RegisterFunction("substrb", new StandardSQLFunction("substrb", NHibernateUtil.String));
+ RegisterFunction("translate", new StandardSQLFunction("translate", NHibernateUtil.String));
+
+ RegisterFunction("locate", new LocateFunction());
+ RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String));
+ RegisterFunction("locate", new SQLFunctionTemplate(NHibernateUtil.Int32, "instr(?2,?1)"));
+ RegisterFunction("bit_length", new SQLFunctionTemplate(NHibernateUtil.Int32, "vsize(?1)*8"));
+ RegisterFunction("coalesce", new NvlFunction());
+
+ // Multi-param numeric dialect functions...
+ RegisterFunction("atan2", new StandardSQLFunction("atan2", NHibernateUtil.Single));
+ RegisterFunction("log", new StandardSQLFunction("log", NHibernateUtil.Int32));
+ RegisterFunction("mod", new StandardSQLFunction("mod", NHibernateUtil.Int32));
+ RegisterFunction("nvl", new StandardSQLFunction("nvl"));
+ RegisterFunction("nvl2", new StandardSQLFunction("nvl2"));
+ RegisterFunction("power", new StandardSQLFunction("power", NHibernateUtil.Single));
+
+ // Multi-param date dialect functions...
+ RegisterFunction("add_months", new StandardSQLFunction("add_months", NHibernateUtil.Date));
+ RegisterFunction("months_between", new StandardSQLFunction("months_between", NHibernateUtil.Single));
+ RegisterFunction("next_day", new StandardSQLFunction("next_day", NHibernateUtil.Date));
+
+ RegisterFunction("str", new StandardSQLFunction("to_char", NHibernateUtil.String));
+ }
+
+ protected internal virtual void RegisterDefaultProperties()
+ {
+ DefaultProperties[Environment.PrepareSql] = "false";
+ DefaultProperties[Environment.DefaultBatchFetchSize] = DefaultBatchSize;
+ // Oracle driver reports to support GetGeneratedKeys(), but they only
+ // support the version taking an array of the names of the columns to
+ // be returned (via its RETURNING clause). No other driver seems to
+ // support this overloaded version.
+ DefaultProperties[Environment.UseGetGeneratedKeys] = "false";
+ }
+
+ // features which change between 8i, 9i, and 10g ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /// <summary>
+ /// Support for the oracle proprietary join syntax...
+ /// </summary>
+ /// <returns> The orqacle join fragment </returns>
+ public override JoinFragment CreateOuterJoinFragment()
+ {
+ return new OracleJoinFragment();
+ }
+
+ /// <summary>
+ /// Map case support to the Oracle DECODE function. Oracle did not
+ /// add support for CASE until 9i.
+ /// </summary>
+ /// <returns> The oracle CASE -> DECODE fragment </returns>
+ public override CaseFragment CreateCaseFragment()
+ {
+ return new DecodeCaseFragment(this);
+ }
+
+ public override SqlString GetLimitString(SqlString sql, bool hasOffset)
+ {
+ sql = sql.Trim();
+ bool isForUpdate = false;
+ if (sql.EndsWithCaseInsensitive(" for update"))
+ {
+ sql = sql.Substring(0, sql.Length - 11);
+ isForUpdate = true;
+ }
+
+ var pagingSelect = new SqlStringBuilder(sql.Parts.Count + 10);
+ if (hasOffset)
+ {
+ pagingSelect.Add("select * from ( select row_.*, rownum rownum_ from ( ");
+ }
+ else
+ {
+ pagingSelect.Add("select * from ( ");
+ }
+ pagingSelect.Add(sql);
+ if (hasOffset)
+ {
+ pagingSelect.Add(" ) row_ where rownum <=").AddParameter().Add(") where rownum_ >").AddParameter();
+ }
+ else
+ {
+ pagingSelect.Add(" ) where rownum <=").AddParameter();
+ }
+
+ if (isForUpdate)
+ {
+ pagingSelect.Add(" for update");
+ }
+
+ return pagingSelect.ToSqlString();
+ }
+
+ /// <summary>
+ /// Allows access to the basic <see cref="Dialect.GetSelectClauseNullString"/>
+ /// implementation...
+ /// </summary>
+ /// <param name="sqlType">The <see cref="SqlType"/> mapping type</param>
+ /// <returns> The appropriate select cluse fragment </returns>
+ public virtual string GetBasicSelectClauseNullString(SqlType sqlType)
+ {
+ return base.GetSelectClauseNullString(sqlType);
+ }
+
+ public override string GetSelectClauseNullString(SqlType sqlType)
+ {
+ switch (sqlType.DbType)
+ {
+ case DbType.String:
+ case DbType.AnsiString:
+ case DbType.StringFixedLength:
+ case DbType.AnsiStringFixedLength:
+ return "to_char(null)";
+
+ case DbType.Date:
+ case DbType.DateTime:
+ case DbType.Time:
+ return "to_date(null)";
+
+ default:
+ return "to_number(null)";
+ }
+ }
+
+ public override string GetSequenceNextValString(string sequenceName)
+ {
+ return "select " + GetSelectSequenceNextValString(sequenceName) + " from dual";
+ }
+
+ public override string GetSelectSequenceNextValString(string sequenceName)
+ {
+ return sequenceName + ".nextval";
+ }
+
+ public override string GetCreateSequenceString(string sequenceName)
+ {
+ return "create sequence " + sequenceName; //starts with 1, implicitly
+ }
+
+ public override string GetDropSequenceString(string sequenceName)
+ {
+ return "drop sequence " + sequenceName;
+ }
+
+ public override bool DropConstraints
+ {
+ get { return false; }
+ }
+
+ public override string ForUpdateNowaitString
+ {
+ get { return " for update nowait"; }
+ }
+
+ public override bool SupportsSequences
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsPooledSequences
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsLimit
+ {
+ get { return true; }
+ }
+
+ public override string GetForUpdateString(string aliases)
+ {
+ return ForUpdateString + " of " + aliases;
+ }
+
+ public override string GetForUpdateNowaitString(string aliases)
+ {
+ return ForUpdateString + " of " + aliases + " nowait";
+ }
+
+ public override bool BindLimitParametersInReverseOrder
+ {
+ get { return true; }
+ }
+
+ public override bool UseMaxForLimit
+ {
+ get { return true; }
+ }
+
+ public override bool ForUpdateOfColumns
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsUnionAll
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsCommentOn
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsTemporaryTables
+ {
+ get { return true; }
+ }
+
+ public override string GenerateTemporaryTableName(String baseTableName)
+ {
+ string name = base.GenerateTemporaryTableName(baseTableName);
+ return name.Length > 30 ? name.Substring(1, (30) - (1)) : name;
+ }
+
+ public override bool DropTemporaryTableAfterUse()
+ {
+ return false;
+ }
+
+ public override bool SupportsCurrentTimestampSelection
+ {
+ get { return true; }
+ }
+
+ #region Overridden informational metadata
+
+ public override bool SupportsEmptyInList
+ {
+ get { return false; }
+ }
+
+ public override bool SupportsExistsInSelect
+ {
+ get { return false; }
+ }
+
+ #endregion
+
+ #region Functions
+
+ private class CurrentTimeStamp : NoArgSQLFunction
+ {
+ public CurrentTimeStamp() : base("current_timestamp", NHibernateUtil.DateTime, true) {}
+
+ public override SqlString Render(IList args, ISessionFactoryImplementor factory)
+ {
+ return new SqlString(Name);
+ }
+ }
+
+ private class LocateFunction : ISQLFunction
+ {
+ private static readonly ISQLFunction LocateWith2Params = new SQLFunctionTemplate(NHibernateUtil.Int32,
+ "instr(?2, ?1)");
+
+ private static readonly ISQLFunction LocateWith3Params = new SQLFunctionTemplate(NHibernateUtil.Int32,
+ "instr(?2, ?1, ?3)");
+
+ #region Implementation of ISQLFunction
+
+ public IType ReturnType(IType columnType, IMapping mapping)
+ {
+ return NHibernateUtil.Int32;
+ }
+
+ public bool HasArguments
+ {
+ get { return true; }
+ }
+
+ public bool HasParenthesesIfNoArguments
+ {
+ get { return true; }
+ }
+
+ public SqlString Render(IList args, ISessionFactoryImplementor factory)
+ {
+ if (args.Count != 2 && args.Count != 3)
+ {
+ throw new QueryException("'locate' function takes 2 or 3 arguments");
+ }
+ if (args.Count == 2)
+ {
+ return LocateWith2Params.Render(args, factory);
+ }
+ else
+ {
+ return LocateWith3Params.Render(args, factory);
+ }
+ }
+
+ #endregion
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Data;
using NHibernate.Dialect.Function;
@@ -30,6 +31,7 @@
/// </item>
/// </list>
/// </remarks>
+ [Obsolete("This dialect will be removed in the next NHibernate version; Use Oracle9iDialect")]
public class Oracle9Dialect : Dialect
{
/// <summary></summary>
Added: trunk/nhibernate/src/NHibernate/Dialect/Oracle9iDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Oracle9iDialect.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Dialect/Oracle9iDialect.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -0,0 +1,40 @@
+using System.Data;
+using NHibernate.SqlCommand;
+using NHibernate.SqlTypes;
+
+namespace NHibernate.Dialect
+{
+ public class Oracle9iDialect : Oracle8iDialect
+ {
+ public override string CurrentTimestampSelectString
+ {
+ get { return "select systimestamp from dual"; }
+ }
+
+ public override string CurrentTimestampSQLFunctionName
+ {
+ get
+ {
+ // the standard SQL function name is current_timestamp...
+ return "current_timestamp";
+ }
+ }
+
+ protected override void RegisterDateTimeTypeMappings()
+ {
+ RegisterColumnType(DbType.Date, "DATE");
+ RegisterColumnType(DbType.DateTime, "TIMESTAMP(4)");
+ RegisterColumnType(DbType.Time, "TIMESTAMP(4)");
+ }
+ public override string GetSelectClauseNullString(SqlType sqlType)
+ {
+ return GetBasicSelectClauseNullString(sqlType);
+ }
+
+ public override CaseFragment CreateCaseFragment()
+ {
+ // Oracle did add support for ANSI CASE statements in 9i
+ return new ANSICaseFragment(this);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Dialect/OracleDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/OracleDialect.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate/Dialect/OracleDialect.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -1,3 +1,4 @@
+using System;
using System.Data;
using NHibernate.SqlCommand;
@@ -6,6 +7,7 @@
/// <summary>
/// An SQL dialect for Oracle, compatible with Oracle 8.
/// </summary>
+ [Obsolete("This dialect will be removed in the next NHibernate version; Use Oracle8iDialect")]
public class OracleDialect : Oracle9Dialect
{
public OracleDialect()
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-02-02 21:33:58 UTC (rev 4013)
@@ -450,6 +450,9 @@
<Compile Include="Dialect\MsSql2008Dialect.cs" />
<Compile Include="Dialect\InformixDialect0940.cs" />
<Compile Include="Dialect\InformixDialect1000.cs" />
+ <Compile Include="Dialect\Oracle10gDialect.cs" />
+ <Compile Include="Dialect\Oracle8iDialect.cs" />
+ <Compile Include="Dialect\Oracle9iDialect.cs" />
<Compile Include="Dialect\OracleLiteDialect.cs" />
<Compile Include="Dialect\Schema\SQLiteMetaData.cs" />
<Compile Include="Dialect\Schema\SybaseAnywhereMetaData.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/Cascade/RefreshFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Cascade/RefreshFixture.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate.Test/Cascade/RefreshFixture.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -22,30 +22,32 @@
[Test]
public void RefreshCascade()
{
- ISession session = OpenSession();
- ITransaction txn = session.BeginTransaction();
+ using(ISession session = OpenSession())
+ {
+ using (ITransaction txn = session.BeginTransaction())
+ {
+ JobBatch batch = new JobBatch(DateTime.Now);
+ batch.CreateJob().ProcessingInstructions = "Just do it!";
+ batch.CreateJob().ProcessingInstructions = "I know you can do it!";
- JobBatch batch = new JobBatch(DateTime.Now);
- batch.CreateJob().ProcessingInstructions = "Just do it!";
- batch.CreateJob().ProcessingInstructions = "I know you can do it!";
+ // write the stuff to the database; at this stage all job.status values are zero
+ session.Persist(batch);
+ session.Flush();
- // write the stuff to the database; at this stage all job.status values are zero
- session.Persist(batch);
- session.Flush();
+ // behind the session's back, let's modify the statuses
+ UpdateStatuses(session);
- // behind the session's back, let's modify the statuses
- UpdateStatuses(session);
+ // Now lets refresh the persistent batch, and see if the refresh cascaded to the jobs collection elements
+ session.Refresh(batch);
- // Now lets refresh the persistent batch, and see if the refresh cascaded to the jobs collection elements
- session.Refresh(batch);
+ foreach (Job job in batch.Jobs)
+ {
+ Assert.That(job.Status, Is.EqualTo(1), "Jobs not refreshed!");
+ }
- foreach (Job job in batch.Jobs)
- {
- Assert.That(job.Status, Is.EqualTo(1), "Jobs not refreshed!");
+ txn.Rollback();
+ }
}
-
- txn.Rollback();
- session.Close();
}
private void UpdateStatuses(ISession session)
@@ -62,33 +64,38 @@
public void RefreshIgnoringTransient()
{
// No exception expected
- ISession session = OpenSession();
- ITransaction txn = session.BeginTransaction();
+ using (ISession session = OpenSession())
+ {
+ using (ITransaction txn = session.BeginTransaction())
+ {
+ var batch = new JobBatch(DateTime.Now);
+ session.Refresh(batch);
- var batch = new JobBatch(DateTime.Now);
- session.Refresh(batch);
-
- txn.Rollback();
- session.Close();
+ txn.Rollback();
+ }
+ }
}
[Test]
public void RefreshIgnoringTransientInCollection()
{
- ISession session = OpenSession();
- ITransaction txn = session.BeginTransaction();
+ using (ISession session = OpenSession())
+ {
+ using (ITransaction txn = session.BeginTransaction())
+ {
- var batch = new JobBatch(DateTime.Now);
- batch.CreateJob().ProcessingInstructions = "Just do it!";
- session.Persist(batch);
- session.Flush();
+ var batch = new JobBatch(DateTime.Now);
+ batch.CreateJob().ProcessingInstructions = "Just do it!";
+ session.Persist(batch);
+ session.Flush();
- batch.CreateJob().ProcessingInstructions = "I know you can do it!";
- session.Refresh(batch);
- Assert.That(batch.Jobs.Count == 1);
+ batch.CreateJob().ProcessingInstructions = "I know you can do it!";
+ session.Refresh(batch);
+ Assert.That(batch.Jobs.Count == 1);
- txn.Rollback();
- session.Close();
+ txn.Rollback();
+ }
+ }
}
[Test]
Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -20,7 +20,7 @@
notSupportedStandardFunction.Add("locate",
new System.Type[] { typeof(MsSql2000Dialect), typeof(MsSql2005Dialect), typeof(MsSql2008Dialect) ,typeof(FirebirdDialect), typeof(PostgreSQLDialect) });
notSupportedStandardFunction.Add("bit_length",
- new System.Type[] { typeof(MsSql2000Dialect), typeof(MsSql2005Dialect), typeof(MsSql2008Dialect) });
+ new System.Type[] { typeof(MsSql2000Dialect), typeof(MsSql2005Dialect), typeof(MsSql2008Dialect), typeof(Oracle9Dialect), typeof(OracleDialect), typeof(Oracle8iDialect), typeof(Oracle9iDialect), typeof(Oracle10gDialect) });
notSupportedStandardFunction.Add("extract",
new System.Type[] { typeof(MsSql2000Dialect), typeof(MsSql2005Dialect), typeof(MsSql2008Dialect) });
}
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1521/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1521/Fixture.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1521/Fixture.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -1,5 +1,6 @@
using System.Text;
using NHibernate.Cfg;
+using NHibernate.Dialect;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
@@ -9,6 +10,12 @@
[TestFixture]
public class Fixture
{
+ private static void CheckDialect(Configuration configuration)
+ {
+ if (!configuration.Properties[Environment.Dialect].Contains("MsSql"))
+ Assert.Ignore("Specific test for MsSQL dialects");
+ }
+
private static void AssertThatCheckOnTableExistenceIsCorrect(Configuration configuration)
{
var su = new SchemaExport(configuration);
@@ -22,6 +29,7 @@
public void TestForClassWithDefaultSchema()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ CheckDialect(cfg);
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1521.AclassWithNothing.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "nhibernate");
cfg.SetProperty(Environment.DefaultSchema, "dbo");
@@ -32,6 +40,7 @@
public void WithDefaultValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ CheckDialect(cfg);
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1521.AclassWithDefault.hbm.xml", GetType().Assembly);
AssertThatCheckOnTableExistenceIsCorrect(cfg);
}
@@ -40,6 +49,7 @@
public void WithSpecificValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ CheckDialect(cfg);
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1521.AclassWithSpecific.hbm.xml", GetType().Assembly);
AssertThatCheckOnTableExistenceIsCorrect(cfg);
}
@@ -48,6 +58,7 @@
public void WithDefaultValuesInConfigurationPriorityToMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ CheckDialect(cfg);
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1521.AclassWithDefault.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "somethingDifferent");
cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent");
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -77,9 +77,9 @@
[Test]
public void InsertZeroLength()
{
- if (typeof(Oracle9Dialect).IsInstanceOfType(Dialect))
+ if (Dialect is Oracle9Dialect || Dialect is Oracle8iDialect)
{
- return;
+ Assert.Ignore("Certain drivers (ie - Oralce) don't handle writing and reading byte[0]");
}
BinaryClass bcBinary = new BinaryClass();
bcBinary.Id = 1;
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/DoubleTypeFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/DoubleTypeFixture.cs 2009-02-02 20:48:55 UTC (rev 4012)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/DoubleTypeFixture.cs 2009-02-02 21:33:58 UTC (rev 4013)
@@ -21,7 +21,7 @@
protected override void OnSetUp()
{
base.OnSetUp();
- if (Dialect is Oracle9Dialect)
+ if (Dialect is Oracle9Dialect || Dialect is Oracle8iDialect)
{
_values[0] = 1.5e20;
_values[1] = 1.2e-20;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|