Consolidate statistics

This is a cherry-pick from the 1.9.x branch:

-------------------

commit 26f7377a0a605b81a0ebff2a31d015a729e0f242
Author: mwjames <jamesin.hongkong.1@gmail.com>
Date:   Sat Nov 3 15:26:27 2012 +0900

    SMW 1.9: Consolidate statistics

    + Consolidate how statistics are provided,
    + Incorporate inline query statistics depends on Change Iccd5fa17

    SQLStore2 + SQLStore3

------------------

Change-Id: I850fac7e6c9de4457975215a12f341274e9c45bb
Display statistics using the SpecialStatsAddExtra hook

This is a cherry-pick from the 1.9.x branch:

--------------

commit 357b04b68b1ecaeca7c8fa46b18b172c66447a12
Author: mwjames <jamesin.hongkong.1@gmail.com>
Date:   Sat Nov 3 17:54:22 2012 +0900

    SMW 1.9: Display statistics using the SpecialStatsAddExtra hook

    Its depends on a core change proposed with ...

-------------

Change-Id: I75b78c7eaf570be1fc41228aa69c95edf314df0e
Fix onSpecialStatsAddExtra

Change-Id: Ia050f65674795a04cf2b2278521c9c23e716d9b8
fix table name access

Change-Id: I9644891569fcf6c089bc467f316e2c14a5af33ed
improved variable names

Change-Id: I8e1bc0482292109cef36fbcc82e3a91f7102463a