Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions application/Core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ private function openDatabaseConnection()
// For example, fetch mode FETCH_ASSOC would return results like this: $result["user_name] !
// @see http://www.php.net/manual/en/pdostatement.fetch.php
$options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING);


//Setting the encoding is different when using PostgreSQL
$enc_opt = "";
if(DB_TYPE=="pgsql")
{
$enc_opt=" options='--client_encoding=" . DB_CHARSET ."'";
}
else
{
$enc_opt="; charset=".DB_CHARSET;
}
// generate a database connection, using the PDO connector
// @see http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/
$this->db = new PDO(DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=' . DB_CHARSET, DB_USER, DB_PASS, $options);
$this->db = new PDO(DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME . $enc_opt, DB_USER, DB_PASS, $options);
}
}