Add function for more DB log details

Add a function which add the SQLSTATE and the database error info to
database output debug logs.
Use writeLogDbError() for verbose SQL errors

Use Utils::writeLogDbError() instead of Utils::writeLog() when a
database error occurs. This will add the SQLSTATE error code and an
error description to the debug log output.
Compare database result with ===

Compare result from database query with three equal signs (===) to make
sure the result returned is a boolean.

Additionally, use is_null() to check for null values.
Make URL parsing more robust

Create a URL object to make the parsing of the path and URL parameters
more robust.
Merge pull request #92 from owncloud/log_dont_output_wrong_error

Don't output wrong errors in the log