Skip to content

Introduce more robust SQL execution and exception handling - #3654

Merged
DeepDiver1975 merged 3 commits into
masterfrom
clean_up_exceptions
Jun 12, 2013
Merged

DeepDiver1975 merged 3 commits into
masterfrom
clean_up_exceptions

Conversation

@butonic

@butonic butonic commented Jun 10, 2013

Copy link
Copy Markdown
Contributor

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 #3583

@karlitschek

Copy link
Copy Markdown
Contributor

👍

@DeepDiver1975

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Jun 12, 2013
Introduce more robust SQL execution and exception handling
@DeepDiver1975
DeepDiver1975 merged commit 1abce78 into master Jun 12, 2013
@DeepDiver1975
DeepDiver1975 deleted the clean_up_exceptions branch June 12, 2013 11:13
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants