Add PostgreSQL support

With the previous cleanup, it is now quite easy to expand further
database support. This patch adds support for the PostgreSQL database.

There is a new concept of dealing with time as an actual timestamp or
the timeseries log. A new unused function is added that needs some
tuning and testing, got_data(), which uses the idea of using the
database's resolution for time rather then calculating our own using
date_trunc.

Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
Add (PDO)SQLite support

This patch adds SQLite support to emoncms. There is one big caveat
however that wasn't solved yet. When using SQLite as a timeseries store,
it is currently not possible to drop tables. When issuing the delete
command from the Webinterface, the table appears to be removed, but the
actual table in the database remains. Since most users will use
timestore for the timeseries log, this most likly won't be a huge issue.

SQLite is also optimized for speed but none of the optimizations have been
preformed such as optimizing the number of writes by caching it in memory
first. Carefully tuning SQLite makes it actually possible to have it
perform as if it where run from memory.

One optimization is to use BEGIN TRANSACTION and END TRANSACTION around
queries and while that is technically possible in db_query, this should
be left to a second patch once SQLite is more stable.

The second optimization is to use PRAGMA to tune parameters. Two
important ones are:
	synchronous=OFF
	temp_store=MEMORY

As with postgres, the current database update mechanism isn't done nor
tested, only creating new databases is.

Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>