Initial try at implementing text_counter

Warning: this code written by somebody has never used SQLite so it's
probably horrific. Somebody come along and tidy up after me please :-)
Merge pull request #3 from kaoru/text_counter

Initial try at implementing text_counter