Skip to content

Commit

Permalink
Readded PDO drivers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Sturgeon committed Nov 22, 2011
1 parent f525f10 commit 0199f68
Show file tree
Hide file tree
Showing 5 changed files with 565 additions and 15 deletions.
10 changes: 10 additions & 0 deletions system/database/drivers/pdo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
30 changes: 15 additions & 15 deletions system/database/drivers/pdo/pdo_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @author EllisLab Dev Team
* @link http://codeigniter.com
* @since Version 2.1.0
* @filesource
Expand All @@ -25,10 +25,9 @@
* @package CodeIgniter
* @subpackage Drivers
* @category Database
* @author ExpressionEngine Dev Team
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/

class CI_DB_pdo_driver extends CI_DB {

var $dbdriver = 'pdo';
Expand All @@ -37,7 +36,7 @@ class CI_DB_pdo_driver extends CI_DB {
var $_escape_char = '';
var $_like_escape_str;
var $_like_escape_chr;


/**
* The syntax to count rows is slightly different across different
Expand All @@ -52,13 +51,13 @@ class CI_DB_pdo_driver extends CI_DB {
function __construct($params)
{
parent::__construct($params);

// clause and character used for LIKE escape sequences
if (strpos($this->hostname, 'mysql') !== FALSE)
{
$this->_like_escape_str = '';
$this->_like_escape_chr = '';

//Prior to this version, the charset can't be set in the dsn
if(is_php('5.3.6'))
{
Expand All @@ -80,6 +79,7 @@ function __construct($params)
}

$this->hostname .= ";dbname=".$this->database;

$this->trans_enabled = FALSE;

$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
Expand Down Expand Up @@ -190,7 +190,7 @@ function _execute($sql)
{
$sql = $this->_prep_query($sql);
$result_id = $this->conn_id->query($sql);

if (is_object($result_id))
{
$this->affect_rows = $result_id->rowCount();
Expand All @@ -199,7 +199,7 @@ function _execute($sql)
{
$this->affect_rows = 0;
}

return $result_id;
}

Expand Down Expand Up @@ -319,16 +319,16 @@ function escape_str($str, $like = FALSE)

return $str;
}

//Escape the string
$str = $this->conn_id->quote($str);

//If there are duplicated quotes, trim them away
if (strpos($str, "'") === 0)
{
$str = substr($str, 1, -1);
}

// escape LIKE condition wildcards
if ($like === TRUE)
{
Expand Down Expand Up @@ -530,7 +530,7 @@ function _escape_identifiers($item)
if (strpos($item, '.') !== FALSE)
{
$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;

}
else
{
Expand Down Expand Up @@ -580,7 +580,7 @@ function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}

// --------------------------------------------------------------------

/**
Expand Down Expand Up @@ -633,7 +633,7 @@ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)

return $sql;
}

// --------------------------------------------------------------------

/**
Expand Down Expand Up @@ -775,7 +775,7 @@ function _limit($sql, $limit, $offset)
{
$sql .= " OFFSET ".$offset;
}

return $sql;
}
}
Expand Down
Loading

0 comments on commit 0199f68

Please sign in to comment.