Un ejemplo:
Código PHP:
Ver originalfinal class Database extends PDO
{
private static $dns = DNS;
private static $username = USERNAME;
private static $password = PASSWORD;
private static $PDO = null;
public static function getInstance()
{
if (!(self::$PDO instanceof PDO)) {
self::$PDO = new PDO(self::$dns, self::$username, self::$password);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return self::$PDO;
}
}
$db = Database::getInstance();
$db->query('DESCRIBE `table`');