Beispiel #1
0
        public static IDbCommand CreateCommand(this IDbConnection connection, AdoOptions options)
        {
            if (options == null || options.CommandTimeout < 0) return connection.CreateCommand();

            var command = connection.CreateCommand();
            command.CommandTimeout = options.CommandTimeout;
            return command;
        }
Beispiel #2
0
        public IDbCommand GetCommand(IDbConnection connection, AdoOptions options)
        {
            var command = connection.CreateCommand(options);

            command.CommandText = Text;
            SetParameters(command, string.Empty);
            if (options != null)
            {
                command.CommandTimeout = options.CommandTimeout;
            }
            return(command);
        }
Beispiel #3
0
        public IDbCommand GetRepeatableCommand(IDbConnection connection, AdoOptions options)
        {
            var command = connection.CreateCommand(options);

            command.CommandText = Text;

            var parameterFactory = CreateParameterFactory(command);

            foreach (var parameter in _parameters.Keys)
            {
                command.Parameters.Add(parameterFactory.CreateParameter(parameter.Name, parameter.Column));
            }
            if (options != null)
            {
                command.CommandTimeout = options.CommandTimeout;
            }
            return(command);
        }
Beispiel #4
0
        internal IDbCommand CreateCommand(ICommandBuilder[] commandBuilders, IDbConnection connection, AdoOptions options)
        {
            var command = connection.CreateCommand(options);

            for (int i = 0; i < commandBuilders.Length; i++)
            {
                if (!string.IsNullOrWhiteSpace(command.CommandText))
                {
                    command.CommandText += "; ";
                }
                command.CommandText += commandBuilders[i].Text;
                SetParameters(command, commandBuilders[i].Parameters);
            }
            return(command);
        }
 internal IDbCommand CreateCommand(ICommandBuilder[] commandBuilders, IDbConnection connection, AdoOptions options)
 {
     var command = connection.CreateCommand(options);
     for (int i = 0; i < commandBuilders.Length; i++)
     {
         if (!string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText += "; ";
         command.CommandText += commandBuilders[i].Text;
         SetParameters(command, commandBuilders[i].Parameters);
     }
     return command;
 }
        public IDbCommand GetRepeatableCommand(IDbConnection connection, AdoOptions options)
        {
            var command = connection.CreateCommand(options);
            command.CommandText = Text;

            var parameterFactory = CreateParameterFactory(command);

            foreach (var parameter in _parameters.Keys)
            {
                command.Parameters.Add(parameterFactory.CreateParameter(parameter.Name, parameter.Column));
            }
            if (options != null)
            {
                command.CommandTimeout = options.CommandTimeout;
            }
            return command;
        }
 public IDbCommand GetCommand(IDbConnection connection, AdoOptions options)
 {
     var command = connection.CreateCommand(options);
     command.CommandText = Text;
     SetParameters(command, string.Empty);
     if (options != null)
     {
         command.CommandTimeout = options.CommandTimeout;
     }
     return command;
 }