diff --git a/product/roundhouse.databases.oracle/OracleDatabase.cs b/product/roundhouse.databases.oracle/OracleDatabase.cs index 67962fa..2a48f5e 100644 --- a/product/roundhouse.databases.oracle/OracleDatabase.cs +++ b/product/roundhouse.databases.oracle/OracleDatabase.cs @@ -1,3 +1,4 @@ +using System.Data.OracleClient; using roundhouse.infrastructure.logging; namespace roundhouse.databases.oracle @@ -86,6 +87,11 @@ public override void set_provider() provider = "System.Data.OracleClient"; } + protected override void connection_specific_setup(IDbConnection connection) + { + ((OracleConnection)connection).InfoMessage += (sender, e) => Log.bound_to(this).log_an_info_event_containing(" [SQL PRINT]: {0}{1}",Environment.NewLine, e.Message); + } + public override void run_database_specific_tasks() { Log.bound_to(this).log_an_info_event_containing("Creating a sequence for the '{0}' table.", version_table_name); diff --git a/product/roundhouse.databases.sqlserver/SqlServerDatabase.cs b/product/roundhouse.databases.sqlserver/SqlServerDatabase.cs index 3251615..52409ff 100644 --- a/product/roundhouse.databases.sqlserver/SqlServerDatabase.cs +++ b/product/roundhouse.databases.sqlserver/SqlServerDatabase.cs @@ -1,3 +1,5 @@ +using System.Data.SqlClient; + namespace roundhouse.databases.sqlserver { using System; @@ -79,6 +81,11 @@ private static string build_connection_string(string server_name, string databas return string.Format("data source={0};initial catalog={1};{2}", server_name, database_name, connection_options); } + protected override void connection_specific_setup(IDbConnection connection) + { + ((SqlConnection)connection).InfoMessage += (sender, e) => Log.bound_to(this).log_an_info_event_containing(" [SQL PRINT]: {0}{1}", Environment.NewLine, e.Message); + } + public override void run_database_specific_tasks() { Log.bound_to(this).log_an_info_event_containing(" Creating {0} schema if it doesn't exist.", roundhouse_schema_name); diff --git a/product/roundhouse/databases/AdoNetDatabase.cs b/product/roundhouse/databases/AdoNetDatabase.cs index 7ca4387..b2c4048 100644 --- a/product/roundhouse/databases/AdoNetDatabase.cs +++ b/product/roundhouse/databases/AdoNetDatabase.cs @@ -28,10 +28,16 @@ private AdoNetConnection GetAdoNetConnection(string conn_string) { provider_factory = DbProviderFactories.GetFactory(provider); IDbConnection connection = provider_factory.CreateConnection(); + connection_specific_setup(connection); + connection.ConnectionString = conn_string; return new AdoNetConnection(connection); } + protected virtual void connection_specific_setup(IDbConnection connection) + { + } + public override void open_admin_connection() { Log.bound_to(this).log_a_debug_event_containing("Opening admin connection to '{0}'", admin_connection_string);