From 5233962fcc0f84cedb9baa2d633ed0231dbd4ff3 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 5 Jul 2010 20:44:47 +0100 Subject: Clean up setup_db function --- idiorm.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'idiorm.php') diff --git a/idiorm.php b/idiorm.php index 657c1f7..7729636 100644 --- a/idiorm.php +++ b/idiorm.php @@ -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']); } } -- cgit v1.2.3