Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php namespace System\Database;
  2.  
  3. final class DBManager
  4. {
  5. private static $connection = null;
  6.  
  7. public static function dumpit()
  8. {
  9. $result = var_dump(self::GetConnection());
  10. return $result;
  11. }
  12.  
  13. /**
  14. * Returns a specifies initialized database handler for a connection.
  15. *
  16. * @param string $ConnectionKey; Could be 'environment'or 'central'.
  17. * @param string $Instance; User 'master' or 'slave' for each instance.
  18. * @return \ADOConnection; Return the database connection object.
  19. */
  20. public static function GetConnection($ConnectionKey = null, $Instance = null)
  21. {
  22. $Server = DB_SERVER;
  23.  
  24. if( self::$connection === null)
  25. {
  26. $DBUser = DB_USER;
  27. $DBPass = DB_PASS;
  28.  
  29. self::$connection = new Database($Server, $DBUser, $DBPass, DB_NAME, DB_PLATFORM);
  30. }
  31.  
  32. return self::$connection;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement