diff options
author | Jamie Matthews <[email protected]> | 2010-07-05 20:44:47 +0100 |
---|---|---|
committer | Jamie Matthews <[email protected]> | 2010-07-05 20:44:47 +0100 |
commit | 5233962fcc0f84cedb9baa2d633ed0231dbd4ff3 (patch) | |
tree | 014149b69eac5042084780eb34077c99033ed6f3 | |
parent | 01b107019848d6702f31811bff517033b1e93b5f (diff) |
Clean up setup_db function
-rw-r--r-- | idiorm.php | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -82,8 +82,8 @@ 'id_column' => 'id', 'id_column_overrides' => array(), 'error_mode' => PDO::ERRMODE_EXCEPTION, - 'username' => false, - 'password' => false, + 'username' => null, + 'password' => null, ); // Database connection, instance of the PDO class @@ -179,15 +179,10 @@ */ private static function setup_db() { if (!is_object(self::$db)) { - if (self::$config['username'] && self::$config['password']) { - self::$db = new PDO( - self::$config['connection_string'], - self::$config['username'], - self::$config['password'] - ); - } else { - self::$db = new PDO(self::$config['connection_string']); - } + $connection_string = self::$config['connection_string']; + $username = self::$config['username']; + $password = self::$config['password']; + self::$db = new PDO($connection_string, $username, $password); self::$db->setAttribute(PDO::ATTR_ERRMODE, self::$config['error_mode']); } } |