1689 lines
58 KiB
C#
1689 lines
58 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Xml;
|
|
|
|
namespace BllSql
|
|
{
|
|
// Token: 0x02000003 RID: 3
|
|
public class SqlHelper
|
|
{
|
|
// Token: 0x06000005 RID: 5 RVA: 0x000020B4 File Offset: 0x000002B4
|
|
private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = command == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("command");
|
|
}
|
|
bool flag2 = commandParameters != null;
|
|
if (flag2)
|
|
{
|
|
foreach (SqlParameter p in commandParameters)
|
|
{
|
|
bool flag3 = p != null;
|
|
if (flag3)
|
|
{
|
|
bool flag4 = (p.Direction == ParameterDirection.InputOutput || p.Direction == ParameterDirection.Input) && p.Value == null;
|
|
if (flag4)
|
|
{
|
|
p.Value = DBNull.Value;
|
|
}
|
|
command.Parameters.Add(p);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000006 RID: 6 RVA: 0x00002148 File Offset: 0x00000348
|
|
private static void AssignParameterValues(SqlParameter[] commandParameters, DataRow dataRow)
|
|
{
|
|
bool flag = commandParameters == null || dataRow == null;
|
|
if (!flag)
|
|
{
|
|
int i = 0;
|
|
foreach (SqlParameter commandParameter in commandParameters)
|
|
{
|
|
bool flag2 = commandParameter.ParameterName == null || commandParameter.ParameterName.Length <= 1;
|
|
if (flag2)
|
|
{
|
|
throw new Exception(string.Format("请提供参数{0}一个有效的名称{1}.", i, commandParameter.ParameterName));
|
|
}
|
|
bool flag3 = dataRow.Table.Columns.IndexOf(commandParameter.ParameterName.Substring(1)) != -1;
|
|
if (flag3)
|
|
{
|
|
commandParameter.Value = dataRow[commandParameter.ParameterName.Substring(1)];
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000007 RID: 7 RVA: 0x00002214 File Offset: 0x00000414
|
|
private static void AssignParameterValues(SqlParameter[] commandParameters, object[] parameterValues)
|
|
{
|
|
bool flag = commandParameters == null || parameterValues == null;
|
|
if (!flag)
|
|
{
|
|
bool flag2 = commandParameters.Length != parameterValues.Length;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("参数值个数与参数不匹配.");
|
|
}
|
|
int i = 0;
|
|
int j = commandParameters.Length;
|
|
while (i < j)
|
|
{
|
|
bool flag3 = parameterValues[i] is IDbDataParameter;
|
|
if (flag3)
|
|
{
|
|
IDbDataParameter paramInstance = (IDbDataParameter)parameterValues[i];
|
|
bool flag4 = paramInstance.Value == null;
|
|
if (flag4)
|
|
{
|
|
commandParameters[i].Value = DBNull.Value;
|
|
}
|
|
else
|
|
{
|
|
commandParameters[i].Value = paramInstance.Value;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool flag5 = parameterValues[i] == null;
|
|
if (flag5)
|
|
{
|
|
commandParameters[i].Value = DBNull.Value;
|
|
}
|
|
else
|
|
{
|
|
commandParameters[i].Value = parameterValues[i];
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000008 RID: 8 RVA: 0x000022F0 File Offset: 0x000004F0
|
|
private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters, out bool mustCloseConnection)
|
|
{
|
|
bool flag = command == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("command");
|
|
}
|
|
bool flag2 = commandText == null || commandText.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("commandText");
|
|
}
|
|
bool flag3 = connection.State != ConnectionState.Open;
|
|
if (flag3)
|
|
{
|
|
mustCloseConnection = true;
|
|
connection.Open();
|
|
}
|
|
else
|
|
{
|
|
mustCloseConnection = false;
|
|
}
|
|
command.Connection = connection;
|
|
command.CommandText = commandText;
|
|
bool flag4 = transaction != null;
|
|
if (flag4)
|
|
{
|
|
bool flag5 = transaction.Connection == null;
|
|
if (flag5)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
command.Transaction = transaction;
|
|
}
|
|
command.CommandType = commandType;
|
|
bool flag6 = commandParameters != null;
|
|
if (flag6)
|
|
{
|
|
SqlHelper.AttachParameters(command, commandParameters);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000009 RID: 9 RVA: 0x000023B8 File Offset: 0x000005B8
|
|
public static string GetConnSting()
|
|
{
|
|
return "Data Source=USER-PC;Initial Catalog=HXAGV_DB_A17168;Persist Security Info=True;User ID=sa;Password=hx123";
|
|
}
|
|
|
|
// Token: 0x0600000A RID: 10 RVA: 0x000023D0 File Offset: 0x000005D0
|
|
public static SqlConnection GetConnection()
|
|
{
|
|
return new SqlConnection(SqlHelper.GetConnSting());
|
|
}
|
|
|
|
// Token: 0x0600000B RID: 11 RVA: 0x000023F0 File Offset: 0x000005F0
|
|
public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteNonQuery(connectionString, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600000C RID: 12 RVA: 0x0000240C File Offset: 0x0000060C
|
|
public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
int result;
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
result = SqlHelper.ExecuteNonQuery(connection, commandType, commandText, commandParameters);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600000D RID: 13 RVA: 0x00002470 File Offset: 0x00000670
|
|
public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
int result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600000E RID: 14 RVA: 0x000024F8 File Offset: 0x000006F8
|
|
public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteNonQuery(connection, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600000F RID: 15 RVA: 0x00002514 File Offset: 0x00000714
|
|
public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, connection, null, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
int retval = cmd.ExecuteNonQuery();
|
|
cmd.Parameters.Clear();
|
|
bool flag2 = mustCloseConnection;
|
|
if (flag2)
|
|
{
|
|
connection.Close();
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
// Token: 0x06000010 RID: 16 RVA: 0x00002574 File Offset: 0x00000774
|
|
public static int ExecuteNonQuery(SqlConnection connection, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
int result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000011 RID: 17 RVA: 0x000025F0 File Offset: 0x000007F0
|
|
public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteNonQuery(transaction, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000012 RID: 18 RVA: 0x0000260C File Offset: 0x0000080C
|
|
public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
int retval = cmd.ExecuteNonQuery();
|
|
cmd.Parameters.Clear();
|
|
return retval;
|
|
}
|
|
|
|
// Token: 0x06000013 RID: 19 RVA: 0x00002688 File Offset: 0x00000888
|
|
public static int ExecuteNonQuery(SqlTransaction transaction, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
int result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000014 RID: 20 RVA: 0x00002730 File Offset: 0x00000930
|
|
public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteDataset(connectionString, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000015 RID: 21 RVA: 0x0000274C File Offset: 0x0000094C
|
|
public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
DataSet result;
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
result = SqlHelper.ExecuteDataset(connection, commandType, commandText, commandParameters);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000016 RID: 22 RVA: 0x000027B0 File Offset: 0x000009B0
|
|
public static DataSet ExecuteDataset(string connectionString, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
DataSet result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000017 RID: 23 RVA: 0x00002838 File Offset: 0x00000A38
|
|
public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteDataset(connection, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000018 RID: 24 RVA: 0x00002854 File Offset: 0x00000A54
|
|
public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, connection, null, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
DataSet result;
|
|
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
da.Fill(ds);
|
|
cmd.Parameters.Clear();
|
|
bool flag2 = mustCloseConnection;
|
|
if (flag2)
|
|
{
|
|
connection.Close();
|
|
}
|
|
result = ds;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000019 RID: 25 RVA: 0x000028E0 File Offset: 0x00000AE0
|
|
public static DataSet ExecuteDataset(SqlConnection connection, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
DataSet result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600001A RID: 26 RVA: 0x0000295C File Offset: 0x00000B5C
|
|
public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteDataset(transaction, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600001B RID: 27 RVA: 0x00002978 File Offset: 0x00000B78
|
|
public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
DataSet result;
|
|
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
da.Fill(ds);
|
|
cmd.Parameters.Clear();
|
|
result = ds;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600001C RID: 28 RVA: 0x00002A24 File Offset: 0x00000C24
|
|
public static DataSet ExecuteDataset(SqlTransaction transaction, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
DataSet result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600001D RID: 29 RVA: 0x00002ACC File Offset: 0x00000CCC
|
|
private static SqlDataReader ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters, SqlHelper.SqlConnectionOwnership connectionOwnership)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool mustCloseConnection = false;
|
|
SqlCommand cmd = new SqlCommand();
|
|
SqlDataReader result;
|
|
try
|
|
{
|
|
SqlHelper.PrepareCommand(cmd, connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
bool flag2 = connectionOwnership == SqlHelper.SqlConnectionOwnership.External;
|
|
SqlDataReader dataReader;
|
|
if (flag2)
|
|
{
|
|
dataReader = cmd.ExecuteReader();
|
|
}
|
|
else
|
|
{
|
|
dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
|
}
|
|
bool canClear = true;
|
|
foreach (object obj in cmd.Parameters)
|
|
{
|
|
SqlParameter commandParameter = (SqlParameter)obj;
|
|
bool flag3 = commandParameter.Direction != ParameterDirection.Input;
|
|
if (flag3)
|
|
{
|
|
canClear = false;
|
|
}
|
|
}
|
|
bool flag4 = canClear;
|
|
if (flag4)
|
|
{
|
|
cmd.Parameters.Clear();
|
|
}
|
|
result = dataReader;
|
|
}
|
|
catch
|
|
{
|
|
bool flag5 = mustCloseConnection;
|
|
if (flag5)
|
|
{
|
|
connection.Close();
|
|
}
|
|
throw;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600001E RID: 30 RVA: 0x00002BCC File Offset: 0x00000DCC
|
|
public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteReader(connectionString, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600001F RID: 31 RVA: 0x00002BE8 File Offset: 0x00000DE8
|
|
public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
SqlConnection connection = null;
|
|
SqlDataReader result;
|
|
try
|
|
{
|
|
connection = new SqlConnection(connectionString);
|
|
connection.Open();
|
|
result = SqlHelper.ExecuteReader(connection, null, commandType, commandText, commandParameters, SqlHelper.SqlConnectionOwnership.Internal);
|
|
}
|
|
catch
|
|
{
|
|
bool flag2 = connection != null;
|
|
if (flag2)
|
|
{
|
|
connection.Close();
|
|
}
|
|
throw;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000020 RID: 32 RVA: 0x00002C58 File Offset: 0x00000E58
|
|
public static SqlDataReader ExecuteReader(string connectionString, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000021 RID: 33 RVA: 0x00002CE0 File Offset: 0x00000EE0
|
|
public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteReader(connection, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000022 RID: 34 RVA: 0x00002CFC File Offset: 0x00000EFC
|
|
public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
return SqlHelper.ExecuteReader(connection, null, commandType, commandText, commandParameters, SqlHelper.SqlConnectionOwnership.External);
|
|
}
|
|
|
|
// Token: 0x06000023 RID: 35 RVA: 0x00002D1C File Offset: 0x00000F1C
|
|
public static SqlDataReader ExecuteReader(SqlConnection connection, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000024 RID: 36 RVA: 0x00002D98 File Offset: 0x00000F98
|
|
public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteReader(transaction, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000025 RID: 37 RVA: 0x00002DB4 File Offset: 0x00000FB4
|
|
public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
return SqlHelper.ExecuteReader(transaction.Connection, transaction, commandType, commandText, commandParameters, SqlHelper.SqlConnectionOwnership.External);
|
|
}
|
|
|
|
// Token: 0x06000026 RID: 38 RVA: 0x00002E0C File Offset: 0x0000100C
|
|
public static SqlDataReader ExecuteReader(SqlTransaction transaction, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000027 RID: 39 RVA: 0x00002EB4 File Offset: 0x000010B4
|
|
public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteScalar(connectionString, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000028 RID: 40 RVA: 0x00002ED0 File Offset: 0x000010D0
|
|
public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
object result;
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
result = SqlHelper.ExecuteScalar(connection, commandType, commandText, commandParameters);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000029 RID: 41 RVA: 0x00002F34 File Offset: 0x00001134
|
|
public static object ExecuteScalar(string connectionString, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
object result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600002A RID: 42 RVA: 0x00002FBC File Offset: 0x000011BC
|
|
public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteScalar(connection, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600002B RID: 43 RVA: 0x00002FD8 File Offset: 0x000011D8
|
|
public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, connection, null, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
object retval = cmd.ExecuteScalar();
|
|
cmd.Parameters.Clear();
|
|
bool flag2 = mustCloseConnection;
|
|
if (flag2)
|
|
{
|
|
connection.Close();
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
// Token: 0x0600002C RID: 44 RVA: 0x00003038 File Offset: 0x00001238
|
|
public static object ExecuteScalar(SqlConnection connection, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
object result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600002D RID: 45 RVA: 0x000030B4 File Offset: 0x000012B4
|
|
public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteScalar(transaction, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x0600002E RID: 46 RVA: 0x000030D0 File Offset: 0x000012D0
|
|
public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
object retval = cmd.ExecuteScalar();
|
|
cmd.Parameters.Clear();
|
|
return retval;
|
|
}
|
|
|
|
// Token: 0x0600002F RID: 47 RVA: 0x0000314C File Offset: 0x0000134C
|
|
public static object ExecuteScalar(SqlTransaction transaction, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
object result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000030 RID: 48 RVA: 0x000031F4 File Offset: 0x000013F4
|
|
public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteXmlReader(connection, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000031 RID: 49 RVA: 0x00003210 File Offset: 0x00001410
|
|
public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool mustCloseConnection = false;
|
|
SqlCommand cmd = new SqlCommand();
|
|
XmlReader result;
|
|
try
|
|
{
|
|
SqlHelper.PrepareCommand(cmd, connection, null, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
XmlReader retval = cmd.ExecuteXmlReader();
|
|
cmd.Parameters.Clear();
|
|
result = retval;
|
|
}
|
|
catch
|
|
{
|
|
bool flag2 = mustCloseConnection;
|
|
if (flag2)
|
|
{
|
|
connection.Close();
|
|
}
|
|
throw;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000032 RID: 50 RVA: 0x00003284 File Offset: 0x00001484
|
|
public static XmlReader ExecuteXmlReader(SqlConnection connection, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = parameterValues != null && parameterValues.Length != 0;
|
|
XmlReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000033 RID: 51 RVA: 0x00003300 File Offset: 0x00001500
|
|
public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText)
|
|
{
|
|
return SqlHelper.ExecuteXmlReader(transaction, commandType, commandText, null);
|
|
}
|
|
|
|
// Token: 0x06000034 RID: 52 RVA: 0x0000331C File Offset: 0x0000151C
|
|
public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
SqlCommand cmd = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
XmlReader retval = cmd.ExecuteXmlReader();
|
|
cmd.Parameters.Clear();
|
|
return retval;
|
|
}
|
|
|
|
// Token: 0x06000035 RID: 53 RVA: 0x00003398 File Offset: 0x00001598
|
|
public static XmlReader ExecuteXmlReader(SqlTransaction transaction, string spName, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
XmlReader result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
result = SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000036 RID: 54 RVA: 0x00003440 File Offset: 0x00001640
|
|
public static void FillDataset(string connectionString, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = dataSet == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
SqlHelper.FillDataset(connection, commandType, commandText, dataSet, tableNames);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000037 RID: 55 RVA: 0x000034B8 File Offset: 0x000016B8
|
|
public static void FillDataset(string connectionString, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = dataSet == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
SqlHelper.FillDataset(connection, commandType, commandText, dataSet, tableNames, commandParameters);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000038 RID: 56 RVA: 0x00003534 File Offset: 0x00001734
|
|
public static void FillDataset(string connectionString, string spName, DataSet dataSet, string[] tableNames, params object[] parameterValues)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = dataSet == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|
{
|
|
connection.Open();
|
|
SqlHelper.FillDataset(connection, spName, dataSet, tableNames, parameterValues);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000039 RID: 57 RVA: 0x000035AC File Offset: 0x000017AC
|
|
public static void FillDataset(SqlConnection connection, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames)
|
|
{
|
|
SqlHelper.FillDataset(connection, commandType, commandText, dataSet, tableNames, null);
|
|
}
|
|
|
|
// Token: 0x0600003A RID: 58 RVA: 0x000035BC File Offset: 0x000017BC
|
|
public static void FillDataset(SqlConnection connection, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames, params SqlParameter[] commandParameters)
|
|
{
|
|
SqlHelper.FillDataset(connection, null, commandType, commandText, dataSet, tableNames, commandParameters);
|
|
}
|
|
|
|
// Token: 0x0600003B RID: 59 RVA: 0x000035D0 File Offset: 0x000017D0
|
|
public static void FillDataset(SqlConnection connection, string spName, DataSet dataSet, string[] tableNames, params object[] parameterValues)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = dataSet == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = parameterValues != null && parameterValues.Length != 0;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
SqlHelper.FillDataset(connection, CommandType.StoredProcedure, spName, dataSet, tableNames, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
SqlHelper.FillDataset(connection, CommandType.StoredProcedure, spName, dataSet, tableNames);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600003C RID: 60 RVA: 0x00003664 File Offset: 0x00001864
|
|
public static void FillDataset(SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames)
|
|
{
|
|
SqlHelper.FillDataset(transaction, commandType, commandText, dataSet, tableNames, null);
|
|
}
|
|
|
|
// Token: 0x0600003D RID: 61 RVA: 0x00003674 File Offset: 0x00001874
|
|
public static void FillDataset(SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames, params SqlParameter[] commandParameters)
|
|
{
|
|
SqlHelper.FillDataset(transaction.Connection, transaction, commandType, commandText, dataSet, tableNames, commandParameters);
|
|
}
|
|
|
|
// Token: 0x0600003E RID: 62 RVA: 0x0000368C File Offset: 0x0000188C
|
|
public static void FillDataset(SqlTransaction transaction, string spName, DataSet dataSet, string[] tableNames, params object[] parameterValues)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = dataSet == null;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
bool flag4 = spName == null || spName.Length == 0;
|
|
if (flag4)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag5 = parameterValues != null && parameterValues.Length != 0;
|
|
if (flag5)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, parameterValues);
|
|
SqlHelper.FillDataset(transaction, CommandType.StoredProcedure, spName, dataSet, tableNames, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
SqlHelper.FillDataset(transaction, CommandType.StoredProcedure, spName, dataSet, tableNames);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600003F RID: 63 RVA: 0x0000374C File Offset: 0x0000194C
|
|
private static void FillDataset(SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string[] tableNames, params SqlParameter[] commandParameters)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = dataSet == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("dataSet");
|
|
}
|
|
SqlCommand command = new SqlCommand();
|
|
bool mustCloseConnection = false;
|
|
SqlHelper.PrepareCommand(command, connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
|
|
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
|
|
{
|
|
bool flag3 = tableNames != null && tableNames.Length != 0;
|
|
if (flag3)
|
|
{
|
|
string tableName = "Table";
|
|
for (int index = 0; index < tableNames.Length; index++)
|
|
{
|
|
bool flag4 = tableNames[index] == null || tableNames[index].Length == 0;
|
|
if (flag4)
|
|
{
|
|
throw new ArgumentException("The tableNames parameter must contain a list of tables, a value was provided as null or empty string.", "tableNames");
|
|
}
|
|
dataAdapter.TableMappings.Add(tableName, tableNames[index]);
|
|
tableName += (index + 1).ToString();
|
|
}
|
|
}
|
|
dataAdapter.Fill(dataSet);
|
|
command.Parameters.Clear();
|
|
}
|
|
bool flag5 = mustCloseConnection;
|
|
if (flag5)
|
|
{
|
|
connection.Close();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000040 RID: 64 RVA: 0x00003874 File Offset: 0x00001A74
|
|
public static void UpdateDataset(SqlCommand insertCommand, SqlCommand deleteCommand, SqlCommand updateCommand, DataSet dataSet, string tableName)
|
|
{
|
|
bool flag = insertCommand == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("insertCommand");
|
|
}
|
|
bool flag2 = deleteCommand == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("deleteCommand");
|
|
}
|
|
bool flag3 = updateCommand == null;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("updateCommand");
|
|
}
|
|
bool flag4 = tableName == null || tableName.Length == 0;
|
|
if (flag4)
|
|
{
|
|
throw new ArgumentNullException("tableName");
|
|
}
|
|
using (SqlDataAdapter dataAdapter = new SqlDataAdapter())
|
|
{
|
|
dataAdapter.UpdateCommand = updateCommand;
|
|
dataAdapter.InsertCommand = insertCommand;
|
|
dataAdapter.DeleteCommand = deleteCommand;
|
|
dataAdapter.Update(dataSet, tableName);
|
|
dataSet.AcceptChanges();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000041 RID: 65 RVA: 0x00003930 File Offset: 0x00001B30
|
|
public static SqlCommand CreateCommand(SqlConnection connection, string spName, params string[] sourceColumns)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
SqlCommand cmd = new SqlCommand(spName, connection);
|
|
cmd.CommandType = CommandType.StoredProcedure;
|
|
bool flag3 = sourceColumns != null && sourceColumns.Length != 0;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
for (int index = 0; index < sourceColumns.Length; index++)
|
|
{
|
|
commandParameters[index].SourceColumn = sourceColumns[index];
|
|
}
|
|
SqlHelper.AttachParameters(cmd, commandParameters);
|
|
}
|
|
return cmd;
|
|
}
|
|
|
|
// Token: 0x06000042 RID: 66 RVA: 0x000039D0 File Offset: 0x00001BD0
|
|
public static int ExecuteNonQueryTypedParams(string connectionString, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
int result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000043 RID: 67 RVA: 0x00003A5C File Offset: 0x00001C5C
|
|
public static int ExecuteNonQueryTypedParams(SqlConnection connection, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
int result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000044 RID: 68 RVA: 0x00003ADC File Offset: 0x00001CDC
|
|
public static int ExecuteNonQueryTypedParams(SqlTransaction transaction, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
int result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000045 RID: 69 RVA: 0x00003B88 File Offset: 0x00001D88
|
|
public static DataSet ExecuteDatasetTypedParams(string connectionString, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
DataSet result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000046 RID: 70 RVA: 0x00003C14 File Offset: 0x00001E14
|
|
public static DataSet ExecuteDatasetTypedParams(SqlConnection connection, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
DataSet result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000047 RID: 71 RVA: 0x00003C94 File Offset: 0x00001E94
|
|
public static DataSet ExecuteDatasetTypedParams(SqlTransaction transaction, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
DataSet result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000048 RID: 72 RVA: 0x00003D40 File Offset: 0x00001F40
|
|
public static SqlDataReader ExecuteReaderTypedParams(string connectionString, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000049 RID: 73 RVA: 0x00003DCC File Offset: 0x00001FCC
|
|
public static SqlDataReader ExecuteReaderTypedParams(SqlConnection connection, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004A RID: 74 RVA: 0x00003E4C File Offset: 0x0000204C
|
|
public static SqlDataReader ExecuteReaderTypedParams(SqlTransaction transaction, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
SqlDataReader result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004B RID: 75 RVA: 0x00003EF8 File Offset: 0x000020F8
|
|
public static object ExecuteScalarTypedParams(string connectionString, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connectionString == null || connectionString.Length == 0;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connectionString");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
object result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004C RID: 76 RVA: 0x00003F84 File Offset: 0x00002184
|
|
public static object ExecuteScalarTypedParams(SqlConnection connection, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
object result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004D RID: 77 RVA: 0x00004004 File Offset: 0x00002204
|
|
public static object ExecuteScalarTypedParams(SqlTransaction transaction, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
object result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004E RID: 78 RVA: 0x000040B0 File Offset: 0x000022B0
|
|
public static XmlReader ExecuteXmlReaderTypedParams(SqlConnection connection, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = connection == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("connection");
|
|
}
|
|
bool flag2 = spName == null || spName.Length == 0;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag3 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
XmlReader result;
|
|
if (flag3)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600004F RID: 79 RVA: 0x00004130 File Offset: 0x00002330
|
|
public static XmlReader ExecuteXmlReaderTypedParams(SqlTransaction transaction, string spName, DataRow dataRow)
|
|
{
|
|
bool flag = transaction == null;
|
|
if (flag)
|
|
{
|
|
throw new ArgumentNullException("transaction");
|
|
}
|
|
bool flag2 = transaction != null && transaction.Connection == null;
|
|
if (flag2)
|
|
{
|
|
throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
|
|
}
|
|
bool flag3 = spName == null || spName.Length == 0;
|
|
if (flag3)
|
|
{
|
|
throw new ArgumentNullException("spName");
|
|
}
|
|
bool flag4 = dataRow != null && dataRow.ItemArray.Length != 0;
|
|
XmlReader result;
|
|
if (flag4)
|
|
{
|
|
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection, spName);
|
|
SqlHelper.AssignParameterValues(commandParameters, dataRow);
|
|
result = SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName, commandParameters);
|
|
}
|
|
else
|
|
{
|
|
result = SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x02000005 RID: 5
|
|
private enum SqlConnectionOwnership
|
|
{
|
|
// Token: 0x04000003 RID: 3
|
|
Internal,
|
|
// Token: 0x04000004 RID: 4
|
|
External
|
|
}
|
|
}
|
|
}
|