示例#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;
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#5
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;
 }
示例#6
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;
        }
示例#7
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;
 }