diff --git a/product/roundhouse.console/roundhouse.console.csproj b/product/roundhouse.console/roundhouse.console.csproj index e98f6e36..87f99812 100644 --- a/product/roundhouse.console/roundhouse.console.csproj +++ b/product/roundhouse.console/roundhouse.console.csproj @@ -47,7 +47,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -57,7 +57,7 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -65,7 +65,7 @@ TRACE true pdbonly - x86 + AnyCPU prompt AllRules.ruleset diff --git a/product/roundhouse.databases.mysql/roundhouse.databases.mysql.csproj b/product/roundhouse.databases.mysql/roundhouse.databases.mysql.csproj index 257a9630..2af0fe95 100644 --- a/product/roundhouse.databases.mysql/roundhouse.databases.mysql.csproj +++ b/product/roundhouse.databases.mysql/roundhouse.databases.mysql.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -52,7 +52,7 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -60,7 +60,7 @@ TRACE true pdbonly - x86 + AnyCPU prompt AllRules.ruleset diff --git a/product/roundhouse.databases.oracle/RoundhousEOracleDriver.cs b/product/roundhouse.databases.oracle/RoundhousEOracleDriver.cs new file mode 100644 index 00000000..e18e6239 --- /dev/null +++ b/product/roundhouse.databases.oracle/RoundhousEOracleDriver.cs @@ -0,0 +1,29 @@ +using System.Data.OracleClient; +using NHibernate.Driver; +using NHibernate.SqlTypes; +using roundhouse.infrastructure.logging; + +namespace roundhouse.databases.oracle +{ + public class RoundhousEOracleDriver : OracleClientDriver + { + protected override void InitializeParameter(System.Data.IDbDataParameter dbParam, string name, SqlType sqlType) + { + base.InitializeParameter(dbParam, name, sqlType); + + //http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html + //System.Data.OracleClient.dll driver generates an exception + //we set the IDbDataParameter.Value = (string whose length: 4000 > length > 2000 ) + //when we set the IDbDataParameter.DbType = DbType.String + //when DB Column is of type NCLOB/CLOB + //The Above is the default behavior for NHibernate.OracleClientDriver + //So we use the built-in StringClobSqlType to tell the driver to use the NClob Oracle type + //This will work for both NCLOB/CLOBs without issues. + //Mapping file will need to be update to use StringClob as the property type + if ((sqlType is StringClobSqlType)) + { + ((OracleParameter)dbParam).OracleType = OracleType.NClob; + } + } + } +} diff --git a/product/roundhouse.databases.oracle/orm/ScriptsRunErrorMapping.cs b/product/roundhouse.databases.oracle/orm/ScriptsRunErrorMapping.cs index 00a7d640..680d3cb0 100644 --- a/product/roundhouse.databases.oracle/orm/ScriptsRunErrorMapping.cs +++ b/product/roundhouse.databases.oracle/orm/ScriptsRunErrorMapping.cs @@ -1,4 +1,6 @@ -namespace roundhouse.databases.oracle.orm +using NHibernate.SqlTypes; + +namespace roundhouse.databases.oracle.orm { using System; using FluentNHibernate.Mapping; @@ -20,9 +22,9 @@ public ScriptsRunErrorMapping() Map(x => x.repository_path); Map(x => x.version).Length(50); Map(x => x.script_name); - Map(x => x.text_of_script).CustomSqlType("Clob"); - Map(x => x.erroneous_part_of_script).CustomSqlType("Clob"); - Map(x => x.error_message).CustomSqlType("Clob"); + Map(x => x.text_of_script).CustomSqlType("Clob").CustomType("StringClob"); + Map(x => x.erroneous_part_of_script).CustomSqlType("Clob").CustomType("StringClob"); + Map(x => x.error_message).CustomSqlType("Clob").CustomType("StringClob"); //audit Map(x => x.entry_date); diff --git a/product/roundhouse.databases.oracle/orm/ScriptsRunMapping.cs b/product/roundhouse.databases.oracle/orm/ScriptsRunMapping.cs index c6e3a104..83f1de54 100644 --- a/product/roundhouse.databases.oracle/orm/ScriptsRunMapping.cs +++ b/product/roundhouse.databases.oracle/orm/ScriptsRunMapping.cs @@ -1,3 +1,5 @@ +using NHibernate.SqlTypes; + namespace roundhouse.databases.oracle.orm { using System; @@ -19,7 +21,7 @@ public ScriptsRunMapping() Id(x => x.id).Column("id").GeneratedBy.Sequence(ApplicationParameters.CurrentMappings.roundhouse_schema_name + "_" + ApplicationParameters.CurrentMappings.scripts_run_table_name + "id").UnsavedValue(0); Map(x => x.version_id); Map(x => x.script_name); - Map(x => x.text_of_script).CustomSqlType("Clob"); + Map(x => x.text_of_script).CustomSqlType("Clob").CustomType("StringClob"); Map(x => x.text_hash).Length(512); Map(x => x.one_time_script); diff --git a/product/roundhouse.databases.oracle/roundhouse.databases.oracle.csproj b/product/roundhouse.databases.oracle/roundhouse.databases.oracle.csproj index 6928b510..f972eae1 100644 --- a/product/roundhouse.databases.oracle/roundhouse.databases.oracle.csproj +++ b/product/roundhouse.databases.oracle/roundhouse.databases.oracle.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -52,7 +52,7 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -60,7 +60,7 @@ TRACE true pdbonly - x86 + AnyCPU prompt AllRules.ruleset @@ -94,6 +94,7 @@ + diff --git a/product/roundhouse.databases.sqlite/roundhouse.databases.sqlite.csproj b/product/roundhouse.databases.sqlite/roundhouse.databases.sqlite.csproj index 000961dc..9b550aa2 100644 --- a/product/roundhouse.databases.sqlite/roundhouse.databases.sqlite.csproj +++ b/product/roundhouse.databases.sqlite/roundhouse.databases.sqlite.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -52,7 +52,7 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset true @@ -61,7 +61,7 @@ TRACE true pdbonly - x86 + AnyCPU prompt AllRules.ruleset diff --git a/product/roundhouse.databases.sqlserver/roundhouse.databases.sqlserver.csproj b/product/roundhouse.databases.sqlserver/roundhouse.databases.sqlserver.csproj index 98091080..df24baad 100644 --- a/product/roundhouse.databases.sqlserver/roundhouse.databases.sqlserver.csproj +++ b/product/roundhouse.databases.sqlserver/roundhouse.databases.sqlserver.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset diff --git a/product/roundhouse.databases.sqlserver2000/roundhouse.databases.sqlserver2000.csproj b/product/roundhouse.databases.sqlserver2000/roundhouse.databases.sqlserver2000.csproj index 2bc29519..26bade62 100644 --- a/product/roundhouse.databases.sqlserver2000/roundhouse.databases.sqlserver2000.csproj +++ b/product/roundhouse.databases.sqlserver2000/roundhouse.databases.sqlserver2000.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset diff --git a/product/roundhouse.tasks/roundhouse.tasks.csproj b/product/roundhouse.tasks/roundhouse.tasks.csproj index 28dfaffd..a82edb9d 100644 --- a/product/roundhouse.tasks/roundhouse.tasks.csproj +++ b/product/roundhouse.tasks/roundhouse.tasks.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -52,14 +52,14 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset ..\..\build_output\RoundhousE\ TRACE true - x86 + AnyCPU prompt AllRules.ruleset diff --git a/product/roundhouse.tests.integration/roundhouse.tests.integration.csproj b/product/roundhouse.tests.integration/roundhouse.tests.integration.csproj index 09504855..e1404c06 100644 --- a/product/roundhouse.tests.integration/roundhouse.tests.integration.csproj +++ b/product/roundhouse.tests.integration/roundhouse.tests.integration.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset diff --git a/product/roundhouse.tests/roundhouse.tests.csproj b/product/roundhouse.tests/roundhouse.tests.csproj index 4dfc4070..871a213f 100644 --- a/product/roundhouse.tests/roundhouse.tests.csproj +++ b/product/roundhouse.tests/roundhouse.tests.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset diff --git a/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs b/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs index 7d52f67f..0acff6fb 100644 --- a/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs +++ b/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs @@ -30,7 +30,8 @@ public NHibernateSessionFactoryBuilder(ConfigurationPropertyHolder config) func_dictionary.Add("roundhouse.databases.mysql.MySqlDatabase, roundhouse.databases.mysql", () => MySQLConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString)); func_dictionary.Add("roundhouse.databases.oracle.OracleDatabase, roundhouse.databases.oracle", - () => OracleClientConfiguration.Oracle9.ConnectionString(configuration_holder.ConnectionString)); + () => OracleClientConfiguration.Oracle9.ConnectionString(configuration_holder.ConnectionString) + .Driver("roundhouse.databases.oracle.RoundhousEOracleDriver, roundhouse.databases.oracle")); func_dictionary.Add("roundhouse.databases.access.AccessDatabase, roundhouse.databases.access", () => JetDriverConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString)); func_dictionary.Add("roundhouse.databases.sqlite.SqliteDatabase, roundhouse.databases.sqlite", @@ -46,7 +47,8 @@ public NHibernateSessionFactoryBuilder(ConfigurationPropertyHolder config) func_dictionary.Add("roundhouse.databases.mysql.MySqlDatabase, " + merged_assembly_name, () => MySQLConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString)); func_dictionary.Add("roundhouse.databases.oracle.OracleDatabase, " + merged_assembly_name, - () => OracleClientConfiguration.Oracle9.ConnectionString(configuration_holder.ConnectionString)); + () => OracleClientConfiguration.Oracle9.ConnectionString(configuration_holder.ConnectionString) + .Driver("roundhouse.databases.oracle.RoundhousEOracleDriver, " + merged_assembly_name)); func_dictionary.Add("roundhouse.databases.access.AccessDatabase, " + merged_assembly_name, () => JetDriverConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString)); func_dictionary.Add("roundhouse.databases.sqlite.SqliteDatabase, " + merged_assembly_name, diff --git a/product/roundhouse/roundhouse.csproj b/product/roundhouse/roundhouse.csproj index 56b0f5e0..24f6395a 100644 --- a/product/roundhouse/roundhouse.csproj +++ b/product/roundhouse/roundhouse.csproj @@ -42,7 +42,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset @@ -52,14 +52,14 @@ TRACE prompt 4 - x86 + AnyCPU AllRules.ruleset ..\..\build_output\RoundhousE\ TRACE true - x86 + AnyCPU prompt AllRules.ruleset