|
From: <fab...@us...> - 2009-06-19 15:50:15
|
Revision: 4490
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4490&view=rev
Author: fabiomaulo
Date: 2009-06-19 15:50:13 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
Improve of MsSql2000Dialect overriding available Dialect configuration.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
trunk/nhibernate/src/NHibernate.Test/DialectTest/DialectFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-06-18 22:32:11 UTC (rev 4489)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-06-19 15:50:13 UTC (rev 4490)
@@ -146,6 +146,26 @@
get { return " null"; }
}
+ public override string CurrentTimestampSQLFunctionName
+ {
+ get { return "CURRENT_TIMESTAMP"; }
+ }
+
+ public override string CurrentTimestampSelectString
+ {
+ get { return "SELECT CURRENT_TIMESTAMP"; }
+ }
+
+ public override bool IsCurrentTimestampSelectStringCallable
+ {
+ get { return false; }
+ }
+
+ public override bool SupportsCurrentTimestampSelection
+ {
+ get { return true; }
+ }
+
/// <summary></summary>
public override bool QualifyIndexName
{
Modified: trunk/nhibernate/src/NHibernate.Test/DialectTest/DialectFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DialectTest/DialectFixture.cs 2009-06-18 22:32:11 UTC (rev 4489)
+++ trunk/nhibernate/src/NHibernate.Test/DialectTest/DialectFixture.cs 2009-06-19 15:50:13 UTC (rev 4490)
@@ -1,7 +1,13 @@
+using System;
using System.Collections.Generic;
-using NHibernate.Cfg;
+using System.Data;
using NHibernate.Dialect;
+using NHibernate.Driver;
+using NHibernate.Engine;
+using NHibernate.SqlCommand;
+using NHibernate.SqlTypes;
using NUnit.Framework;
+using Environment=NHibernate.Cfg.Environment;
namespace NHibernate.Test.DialectTest
{
@@ -132,5 +138,31 @@
Dialect.Dialect dialect = Dialect.Dialect.GetDialect(props);
Assert.IsTrue(dialect is MsSql2000Dialect);
}
+
+ [Test]
+ public void CurrentTimestampSelection()
+ {
+ var conf = TestConfigurationHelper.GetDefaultConfiguration();
+ Dialect.Dialect dialect = Dialect.Dialect.GetDialect(conf.Properties);
+ if (!dialect.SupportsCurrentTimestampSelection)
+ {
+ Assert.Ignore("This test does not apply to " + dialect.GetType().FullName);
+ }
+ var sessions = (ISessionFactoryImplementor) conf.BuildSessionFactory();
+ sessions.ConnectionProvider.Configure(conf.Properties);
+ IDriver driver = sessions.ConnectionProvider.Driver;
+
+ using (IDbConnection connection = sessions.ConnectionProvider.GetConnection())
+ {
+ IDbCommand statement = driver.GenerateCommand(CommandType.Text, new SqlString(dialect.CurrentTimestampSelectString),
+ new SqlType[0]);
+ statement.Connection = connection;
+ using(IDataReader reader = statement.ExecuteReader())
+ {
+ Assert.That(reader.Read(), "should return one record");
+ Assert.That(reader[0], Is.InstanceOf<DateTime>());
+ }
+ }
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|