owncloud/core — pull request #3654 by butonic (2013-06-10 12:00:47+00:00)
Title: Introduce more robust SQL execution and exception handling

Ok, it's starting to get more meaty. This PR introduces the OC_DB::executeAudited() method that handles execution of plain SQL, an array or a prepared statement. It automagically checks the sql for forbidden usage of LIMIT, converts plain sql or an array to a prepared statement, executes the prepared statement, and throws a DatabaseException when an error occurs.

Based on that I cleaned up the use of the DatabaseSetupException used during installation.

I added the internal server error status to OC_Response and made sure any exceptions get caught in index.php, remote.php, public.php and cron.php, get logged and return 500.

Basically this will allow exceptions to bubble up in the phpunit tests on CI. Currently most queries do not even check the error status and if they do immediately render an error page, which prevents phpunit from showing the actual error.

@karlitschek @DeepDiver1975 @icewind1991 @MTGap @bartv2 please review

Originally part of https://github.com/owncloud/core/pull/3583