datalayer - remove mess introduced in f312bd7ee03b

This commit is contained in:
Stephan
2013-02-05 14:36:56 -01:00
parent 56281d64b0
commit eaa36a248c
2 changed files with 6 additions and 27 deletions

View File

@@ -188,17 +188,6 @@ namespace umbraco.DataLayer
/// <remarks>Abstract factory pattern</remarks>
public abstract IParameter CreateParameter(string parameterName, object value);
bool SilentCommand(ref string commandText)
{
bool writelog = true;
if (commandText.StartsWith("#"))
{
writelog = false;
commandText = commandText.Substring(1);
}
return writelog;
}
/// <summary>
/// Executes a command that returns a single value.
/// </summary>
@@ -209,7 +198,6 @@ namespace umbraco.DataLayer
/// <exception cref="umbraco.DataLayer.SqlHelperException">If a data source error occurs.</exception>
public T ExecuteScalar<T>(string commandText, params IParameter[] parameters)
{
bool writelog = SilentCommand(ref commandText);
string commandConverted = ConvertCommand(commandText);
P[] parametersConverted = ConvertParameters(parameters);
try
@@ -218,8 +206,7 @@ namespace umbraco.DataLayer
}
catch (Exception e)
{
if (writelog)
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
throw new SqlHelperException("ExecuteScalar", commandText, parameters, e);
}
}
@@ -235,7 +222,6 @@ namespace umbraco.DataLayer
/// <exception cref="umbraco.DataLayer.SqlHelperException">If a data source error occurs.</exception>
public int ExecuteNonQuery(string commandText, params IParameter[] parameters)
{
bool writelog = SilentCommand(ref commandText);
string commandConverted = ConvertCommand(commandText);
P[] parametersConverted = ConvertParameters(parameters);
try
@@ -244,8 +230,7 @@ namespace umbraco.DataLayer
}
catch (Exception e)
{
if (writelog)
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
throw new SqlHelperException("ExecuteNonQuery", commandText, parameters, e);
}
}
@@ -261,7 +246,6 @@ namespace umbraco.DataLayer
/// <exception cref="umbraco.DataLayer.SqlHelperException">If a data source error occurs.</exception>
public IRecordsReader ExecuteReader(string commandText, params IParameter[] parameters)
{
bool writelog = SilentCommand(ref commandText);
string commandConverted = ConvertCommand(commandText);
P[] parametersConverted = ConvertParameters(parameters);
try
@@ -270,8 +254,7 @@ namespace umbraco.DataLayer
}
catch (Exception e)
{
if (writelog)
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
throw new SqlHelperException("ExecuteReader", commandText, parameters, e);
}
}
@@ -287,7 +270,6 @@ namespace umbraco.DataLayer
/// <exception cref="umbraco.DataLayer.SqlHelperException">If a data source error occurs.</exception>
public XmlReader ExecuteXmlReader(string commandText, params IParameter[] parameters)
{
bool writelog = SilentCommand(ref commandText);
string commandConverted = ConvertCommand(commandText);
P[] parametersConverted = ConvertParameters(parameters);
try
@@ -296,8 +278,7 @@ namespace umbraco.DataLayer
}
catch (Exception e)
{
if (writelog)
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
LogHelper.Error<SqlHelper<P>>(string.Format("Error executing query {0}", commandText), e);
throw new SqlHelperException("ExecuteXmlReader", commandText, parameters, e);
}
}

View File

@@ -196,8 +196,7 @@ namespace umbraco.DataLayer.Utility.Installer
{
if(v.ExpectedRows > -1)
{
// execute and don't write to the log!
using (var reader = SqlHelper.ExecuteReader("#" + v.Sql))
using (var reader = SqlHelper.ExecuteReader(v.Sql))
{
var rowCount = 0;
while (reader.Read())
@@ -209,8 +208,7 @@ namespace umbraco.DataLayer.Utility.Installer
}
else
{
// execute and don't write to the log!
SqlHelper.ExecuteNonQuery("#" + v.Sql);
SqlHelper.ExecuteNonQuery(v.Sql);
}
//if (!String.IsNullOrEmpty(v.Table) && !String.IsNullOrEmpty(v.Field) && !String.IsNullOrEmpty(v.Value))