Fixed incorrect datatype conversion on multi-indexes

When creating a new table from a `pandas` dataframe with a multi-index, the code would iterate over the index columns backwards but use their types as if counting forwards.  This meant that the created table had incorrect indexes for multi-indexes.

This code factors out a function to pull column names and column types for both SQLAlchemy and legacy table objects.  This code now iterates over the indices properly.

And additional test has been written.  All test pass on my local machine.

Closes https://github.com/pydata/pandas/issues/8021 .
Yes, good reasons (indeed, with current pandas (with the bug) you get two float columns as a result of these dynamic types). 
But in any case, you can put it in `TestSQLApi` (also with sqlite and sqlalchemy, so don't need to change something in the test). 
And I would also try to test it for the fallback mode in `_TestSQLApi`. I think splitting up the create statement, and checking `"INTEGER" in lines[1]`/`"REAL" in lines[2]` or something like that is indeed a bit brittle, but I think not too bad (should we change the create statement, we just have to adapt the test). Or do it with writing/reading anyway (it is not a full guarantee, but such a test *would* fail at the moment, so it will test at least something ..)