예제 #1
0
        internal IDictionary <string, object> ExecuteSingletonQuery(string sql, params object[] values)
        {
            using (var connection = _adapter.CreateConnection())
            {
                using (var command = CommandHelper.Create(connection, sql, values.ToArray()))
                {
                    try
                    {
                        connection.Open();
                        using (var reader = command.ExecuteReader())
                        {
                            if (reader.Read())
                            {
                                return(reader.ToDictionary());
                            }
                        }
                    }
                    catch (DbException ex)
                    {
                        throw new AdoAdapterException(ex.Message, command);
                    }
                }
            }

            return(null);
        }
예제 #2
0
        private IEnumerable <IDictionary <string, object> > ExecuteQuery(string sql, params object[] values)
        {
            var connection = _adapter.CreateConnection();
            var command    = CommandHelper.Create(connection, sql, values);

            return(command.ToAsyncEnumerable());
        }
예제 #3
0
 internal int Execute(string sql, params object[] values)
 {
     using (var connection = _adapter.CreateConnection())
     {
         using (var command = CommandHelper.Create(connection, sql, values.ToArray()))
         {
             return(TryExecute(connection, command));
         }
     }
 }