Use default_timeout() for TCP timeouts.

Use emysql_app:default_timeout() instead of hardcoding ?TIMEOUT for the
TCP timeouts.

This makes it possible to have timeouts that are longer than 8 seconds
(previously the TCP layer would time out at 8 secs even if the higher layer
set a long timeout).
Use an unambiguous string to represent datetimes.

This sends a datetime to MySQL as 'YYYY-MM-DD hh:mm:ss' instead of the
numeric YYYYMMDDhhmmss.

This avoids problems when using small dates, such as year 1.  In that case
the previous code was sending 01 as the year part, which MySQL parses as
2001, not 1.

The accepted formats are documented at
http://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html.
Maybe one day MySQL will support ISO 8601 *sigh*
Merge pull request #73 from tipbit/use-iso-dates

Use an unambiguous string to represent datetimes.
Merge pull request #71 from tipbit/configurable-tcp-timeout

Use default_timeout() for TCP timeouts.
Removed unecessary duplication of code.

Conflicts:
	src/emysql.erl
Be more explicit in result handling.

Conflicts:
	src/emysql.erl
	src/emysql_conn_mgr.erl
Do not spawn a process to close stale connections.

  This ensures that the old connection is closed before a new one is opened
  and so fixes possibility of opening more connections than the mysql server
  is configured to allow.

Conflicts:
	src/emysql_conn.erl
Removed costly and unecessary unprepare statement call when closing a connection.

  The server will remove them automatically when the connection is closed.
Removed unecessary duplication of code fixing minor semantic issue.

  Ensure the pool is removed from the connection manager before closing
  the connections.  Not that this really matters as we are shutting down.
Fixed wrong Connection object from being queued.

  The new Connection object could have been modified externally,
  so we must use store it and not the old one.

Conflicts:
	src/emysql_conn_mgr.erl
Refresh locked_at timestamp when passing connection to waiting pid.

Conflicts:
	src/emysql_conn_mgr.erl
Ensured tcp socket is closed when open_connection fails.

Conflicts:
	src/emysql_conn.erl
No need to specify module on internal function calls

Conflicts:
	src/emysql_conn.erl
Fixed starvation of waiting processes

  When a connection is replaced it was not given to a
  waiting process. This fixes that. Also when additional
  connections are added to the pool, waiting processes
  are now served from those connections.

Conflicts:
	src/emysql_conn_mgr.erl
Unified connection locking code
Merged internal lock_connection and lock_connection_or_wait handlers

Conflicts:
	src/emysql_conn_mgr.erl
Merged internal replace_connection and unlock_connection handlers

Conflicts:
	src/emysql_conn_mgr.erl
Avoid orphaning opened connections in emysql_conn:open_connections/1.

Conflicts:
	src/emysql_conn.erl
Sacrifice an unused function to the gods of void.
Fixed code path allowing a connection to remain locked forever.

Conflicts:
	src/emysql_conn.erl