Skip to content

Commit

Permalink
Merge branch 'master' of git.cryto.net:projects/joepie91/cphp
Browse files Browse the repository at this point in the history
  • Loading branch information
joepie91 committed May 23, 2013
2 parents a90ffa5 + d42eeca commit 21f3cea
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions include.mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@

$cphp_mysql_connected = false;

if(!empty($cphp_config->database->driver))
{
if(empty($cphp_config->database->database))
{
die("No database was configured. Refer to the CPHP manual for instructions.");
}

try
{
$database = new CachedPDO("mysql:host={$cphp_config->database->hostname};dbname={$cphp_config->database->database}", $cphp_config->database->username, $cphp_config->database->password);
$database->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING);
$cphp_mysql_connected = true;
}
catch (Exception $e)
{
die("Could not connect to the specified database. Refer to the CPHP manual for instructions.");
}
}

class CachedPDO extends PDO
{
public function CachedQuery($query, $parameters = array(), $expiry = 60)
Expand Down Expand Up @@ -140,3 +121,22 @@ public function GuessType($value)
}
}
}

if(!empty($cphp_config->database->driver))
{
if(empty($cphp_config->database->database))
{
die("No database was configured. Refer to the CPHP manual for instructions.");
}

try
{
$database = new CachedPDO("mysql:host={$cphp_config->database->hostname};dbname={$cphp_config->database->database}", $cphp_config->database->username, $cphp_config->database->password);
$database->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING);
$cphp_mysql_connected = true;
}
catch (Exception $e)
{
die("Could not connect to the specified database. Refer to the CPHP manual for instructions.");
}
}

0 comments on commit 21f3cea

Please sign in to comment.