示例#1
0
        public List<ResultSet> ExecuteAdHocQuery(string adhocQuery, CommandOptions commandOptions)
        {
            Open();
            using (var command = new SqlCommand()) {
                command.CommandTimeout = commandOptions.CommandTimeout;
                command.CommandType = CommandType.Text;
                command.CommandText = adhocQuery;
                command.Connection = connection;
                command.Transaction = transaction;

                using (var reader = command.ExecuteReader()) {
                    return ConvertReaderToMultipleResultSet(reader);
                }
            }
        }
示例#2
0
        public List<ResultSet> ExecuteStoredProcedure(string procedureName, Dictionary<string, object> parameters, CommandOptions commandOptions)
        {
            Open();
            using (var command = new SqlCommand()) {
                command.CommandTimeout = commandOptions.CommandTimeout;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = procedureName;
                command.Connection = connection;
                command.Transaction = transaction;

                foreach (var parameter in parameters) {
                    command.Parameters.Add(new SqlParameter(parameter.Key, parameter.Value));
                }

                using (var reader = command.ExecuteReader()) {
                    return ConvertReaderToMultipleResultSet(reader);
                }
            }
        }
示例#3
0
        public List<ResultSet> ExecuteStoredProcedure(string procedureName, Dictionary<string, object> parameters, CommandOptions commandOptions)
        {
            if (procedureName.Contains('.')) {
                throw new ArgumentException("MySql does not support schemas");
            }

            Open();
            using (var command = new MySqlCommand()) {
                command.CommandTimeout = commandOptions.CommandTimeout;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = procedureName;
                command.Connection = connection;
                command.Transaction = transaction;

                foreach (var parameter in parameters) {
                    command.Parameters.Add(new MySqlParameter(parameter.Key, parameter.Value));
                }

                using (var reader = command.ExecuteReader()) {
                    return ConvertReaderToMultipleResultSet(reader);
                }
            }
        }
示例#4
0
        private MultipleResultSetConverter ExecuteStoredProcedure(string sprocName, Dictionary <string, object> parameters, CommandOptions commandOptions)
        {
            var schemaPrefix = GetSchemaPrefix(sprocName);

            return(WithCommand((command) => {
                return new MultipleResultSetConverter(command.ExecuteStoredProcedure(schemaPrefix + sprocName, parameters, commandOptions));
            }));
        }
示例#5
0
 public MultipleResultSetConverter ExecuteAdHocQuery(string adhocQuery, CommandOptions commandOptions)
 {
     return(WithCommand((command) => {
         return new MultipleResultSetConverter(command.ExecuteAdHocQuery(adhocQuery, commandOptions));
     }));
 }
示例#6
0
 public MultipleResultSetConverter ExecuteStoredProcedure <InputModel>(InputModel inputModel, CommandOptions commandOptions, [CallerMemberName] string sprocName = "")
 {
     return(ExecuteStoredProcedure(sprocName, GetParameters(inputModel), commandOptions));
 }
示例#7
0
 public MultipleResultSetConverter ExecuteStoredProcedure(CommandOptions commandOptions, [CallerMemberName] string sprocName = "")
 {
     return(ExecuteStoredProcedure(sprocName, new Dictionary <string, object>(), commandOptions));
 }