db layer rewrite

add bridge classes for easier future replacement of db layer

new interface throws `DbException` when errors occur and logging is performed by db layer, not needed to do it in application level.

table prefix is handled with `{{%table}}` escaping: `%` is replaced with table prefix ``{{}}`` is replaced with table quoting chars.

also this branch tries to use query placeholders where possible (some code was too difficult to change without  breaking it easily)

implemented two classes:
  - `DbPear` - proxy to PEAR DB class
  - `DbNull` - empty class implementing methods by `DbInterface`

`DB_Helper::getInstance()` always returns a `DbInterface` instance. this is needed to handle cyclic dependencies, i.e on db error `offline.php` is loaded, which uses db methods to do `Misc::escape*`

this is WIP branch, will be submitting more commits here

  - [x] add new bridge code which keeps current PEAR::DB api
  - [x] use exceptions
  - [x] replace code to use exceptions
  - [x] drop APP_DEFAULT_DB and APP_TABLE_PREFIX from core code
  - [ ] replace confusing calls getCol and getAssoc with alternatives, no more DB_* constants
    - [x] replace getAssoc(stmt_with_two_columns, false, array()) -> getPair()
    - [x] replace confusing getCol($sql, 0, $params) with getColumn($sql, $params)
    - [x] make getRow DB_FETCHMODE_ASSOC as default
    - [x] make getAll DB_FETCHMODE_ASSOC as default
  - [ ] no more DB_* constants

also found bunch of bugs (FIXME, TODO) which sould be fixed afterwards
FIXME: usr_preferences needs to be json encoded?