Using code from amlweems, added iOS6 support.

The code is pretty ugly. I tried to minimize changes to iOSx code path where x < 6, as I don't have a SQLite3 DB in that format to test against. It should hopefully still work though.

Added a "-6" flag. Auto-detect shouldn't be too hard, obviating the need for this flag. If you can get me an older SQLite3 DB, I can test against it. It can be a small one.