summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorJamie Matthews <[email protected]>2010-07-05 20:44:47 +0100
committerJamie Matthews <[email protected]>2010-07-05 20:44:47 +0100
commit5233962fcc0f84cedb9baa2d633ed0231dbd4ff3 (patch)
tree014149b69eac5042084780eb34077c99033ed6f3 /idiorm.php
parent01b107019848d6702f31811bff517033b1e93b5f (diff)
Clean up setup_db function
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php17
1 files changed, 6 insertions, 11 deletions
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']);
}
}