Example #1
0
        public int ExecuteNonQuery(SQLiteConnection connection, string sql, IList <IParameter> parameters)
        {
            if (connection == null || string.IsNullOrEmpty(sql))
            {
                return(0);
            }

#if DEBUG
            Trace.WriteLine(sql);
#endif

            using (var command = connection.CreateCommand())
            {
                command.CommandType = CommandType.Text;
                command.CommandText = sql;
                if (parameters != null)
                {
                    foreach (var parameter in parameters)
                    {
                        _parameterConverter.AddParameter(command, parameter);
                    }
                }
                return(command.ExecuteNonQuery());
            }
        }
Example #2
0
        public ICommandProcessor Initialize(
            IRepository repository,
            ICommand command,
            SQLiteConnection connection,
            SQLiteTransaction transaction)
        {
            _command = new SQLiteCommand(command.CommandText, connection, transaction);

            if (command.TimeoutSeconds.HasValue)
            {
                CommandTimeout = command.TimeoutSeconds.Value;
            }

            foreach (var parameter in command.GetParameters())
            {
                _parameterConverter.AddParameter(_command, parameter);
            }

            return(this);
        }