Question: I understand from my recent use of PHP-PDO over the last few months that you can do a PREPARE statement and then run the query. In fact I can see the usefulness of this if I'm going to either SELECT on a complex join, varying the where conditions, a repeated number of times.

Or, similarly, if I was wanting to insert multiple records.

However, if I know I only want to run a statement once, shouldn't I just EXECUTE the query? I'm basically querying the database twice.

Answer: 
I thought a struct with an internal Dictionary would be the way to go. I have only just started using it, so it’s not complete and I have no idea on performance yet.

```
struct Set<T : Hashable>
{
    var _items : Dictionary<T, Bool> = [:]

    mutating func add(newItem : T) {
        _items[newItem] = true
    }

    mutating func remove(newItem : T) {
        _items[newItem] = nil
    }

    func contains(item: T) -> Bool {
        if _items.indexForKey(item) != nil { return true } else { return false }
    }

    var items : [T] { get { return [T](_items.keys) } }
    var count : Int { get { return _items.count } }
}

```
So I think creating a Set with an array is a terrible idea - O(n) is the time complexity of that set. 

I have put together a nice Set that uses a dictionary: <https://github.com/evilpenguin/Swift-Stuff/blob/master/Set.swift>