Fix globcnt is zero crash

I have hit this crash while trying to import a PST file.
Pull request went out to become somewhat big (I ended up here while trying to isolate while the crash).
The cherry on the top of the cake is actually the last patch - 13d7bbc1783d8348df7c63b2b062bedb2881a15e
(at least this fixed the problem for me)

It turned out we initializing TDB backend for Indexing while every other backend defaults to MySQL.
I this this is widely untested combination and also undesired :)

Please review!

Please also note that this pull request is superset for #90
So we should either merge this one and discard #90 OR merge #90 first and the I will clean up this
request to contain only distinct patches.
This is yet a mystery for me too :)
All was good and all the sudden I got mid = 1, which results in globcnt=0.
There were quite some things happening, debugging took a huge amount of time,
so I just decided to start refactoring towards better error checking (it was missing
in some places at all).

I do agree with you it is better for this check to be done in openchangedb layer.
I think implementing it in openchangedb thought, so that knowledge for
what is right/wrong indexing URL stays at single place
I will check also for 'empty' string (not quite valid indexing URL either, right)