Committed by domob - adding NameHistory - Thanks!
better logging to find the rare status 21 bug returned by sqlite
Implement name_scan.

Implement name_scan.  The implementation tries to emulate the ordering
behaviour of namecoind's name_scan, although it doesn't fully do it for
binary data.  Also, this order is not "natural" with respect to SQLite.