Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. test.php :
  2.  
  3. try
  4. {
  5. $mydb = new DBWrapper(false);
  6. $mydb->test1("select * from...", null, null);
  7. }
  8. catch ( Exception $ex )
  9. {
  10. die($ex->getMessage());
  11. }
  12.  
  13. ---------------------
  14. DBWrapper.php
  15.  
  16. public function test1($sql, $paramData = null, $paramDataInclConfigs = null)
  17. {
  18. try
  19. {
  20. $this->test2($sql, $paramData, $paramDataInclConfigs);
  21. }
  22. catch ( Exception $ex )
  23. {
  24. error_log($this->getConfig('PROJECT_NAME') . ": test1() : caught Exception! Re-throwing...", 0);
  25. throw $ex;
  26. }
  27. }
  28.  
  29. private function test2()
  30. {
  31. try
  32. {
  33. $conn = &$this->getConnection();
  34. $dbWrapperStmt = new DBWrapperStatement($conn, $sql, $paramData, $paramDataInclConfigs, self::$debug);
  35. }
  36. catch ( Exception $ex )
  37. {
  38. error_log($this->getConfig('PROJECT_NAME') . ": test2() : caught Exception! Re-throwing...", 0);
  39. throw $ex;
  40. }
  41. }
  42.  
  43. ---------------------
  44. DBWrapperStatement.php
  45.  
  46. public function __construct(&$conn, $sql, $paramData = null, $paramConfig = null, $debug = false)
  47. {
  48. self::$conn = &$conn;
  49. self::$sql = trim($sql);
  50. self::$paramData = $paramData;
  51. self::$paramConfig = $paramConfig;
  52. self::$debug = $debug;
  53.  
  54. throw new DBWrapperStatementException("TEST!!!", 0, $this->getConfig('PROJECT_NAME'), self::$debug);
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement