adding second argument to DatabaseException
updated some PHPDoc comments
fixing undefined variable in line 789 - actually unrelated but well ....