summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
committerGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
commitef38f0a6d83025fbd99ace5ec60311acfe9121c4 (patch)
tree1728bc5df9412d8eccc2919bf3cd3f6bbe6a52d0 /system/database/drivers
parentd90e1a0fb541ee94459a20cf8b0726aebaec9692 (diff)
parenta96ade374f28cdae97036fc253fd8b2a0e8dc81a (diff)
Merge branch 'develop' into feature/unit-tests
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php12
-rw-r--r--system/database/drivers/oci8/oci8_driver.php9
-rw-r--r--system/database/drivers/oci8/oci8_result.php4
-rw-r--r--system/database/drivers/pdo/pdo_driver.php9
-rw-r--r--system/database/drivers/postgre/postgre_forge.php6
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php2
6 files changed, 24 insertions, 18 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 828ef006b..6ded6e531 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -606,7 +606,7 @@ class CI_DB_mysql_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ function _update($table, $values, $where, $orderby = array(), $limit = FALSE, $like = array())
{
foreach ($values as $key => $val)
{
@@ -620,6 +620,16 @@ class CI_DB_mysql_driver extends CI_DB {
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
+
+ if (count($like) > 0)
+ {
+ $sql .= ($where == '' AND count($where) <1) ? " WHERE " : ' AND ';
+
+ foreach ($like as $st_like)
+ {
+ $sql .= " " . $st_like;
+ }
+ }
$sql .= $orderby.$limit;
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 190b86bb2..9c38dcbd6 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -661,11 +661,10 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific insert string from the supplied data
*
- * @access protected
- * @param string the table name
- * @param array the insert keys
- * @param array the insert values
- * @return string
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
*/
protected function _insert_batch($table, $keys, $values)
{
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 3ec71a9d6..f32559289 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -57,11 +57,11 @@ class CI_DB_oci8_result extends CI_DB_result {
if ($this->num_rows === 0 && count($this->result_array()) > 0)
{
$this->num_rows = count($this->result_array());
- @oci_execute($this->stmt_id);
+ @oci_execute($this->stmt_id, OCI_DEFAULT);
if ($this->curs_id)
{
- @oci_execute($this->curs_id);
+ @oci_execute($this->curs_id, OCI_DEFAULT);
}
}
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 5f63a3771..457cf714a 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -90,7 +90,10 @@ class CI_DB_pdo_driver extends CI_DB {
$this->_like_escape_chr = '!';
}
- $this->hostname .= ";dbname=".$this->database;
+ if (strpos($this->hostname, 'sqlite') === FALSE)
+ {
+ $this->hostname .= ";dbname=".$this->database;
+ }
$this->trans_enabled = FALSE;
@@ -255,11 +258,7 @@ class CI_DB_pdo_driver extends CI_DB {
// Reset the transaction failure flag.
// If the $test_mode flag is set to TRUE transactions will be rolled back
// even if the queries produce a successful result.
-<<<<<<< HEAD
- $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
-=======
$this->_trans_failure = (bool) ($test_mode === TRUE);
->>>>>>> master
return $this->conn_id->beginTransaction();
}
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 166cc4e6a..f86ba2dda 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -81,9 +81,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if ($if_not_exists === TRUE)
{
+ // PostgreSQL doesn't support IF NOT EXISTS syntax so we check if table exists manually
if ($this->db->table_exists($table))
{
- return "SELECT * FROM $table"; // Needs to return innocous but valid SQL statement
+ return TRUE;
}
}
@@ -224,9 +225,6 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop Table
- *
- * @access private
- * @return bool
*/
function _drop_table($table)
{
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 0f9f57836..340cd3a66 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -98,7 +98,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
function db_pconnect()
{
- $this->db_connect(TRUE);
+ return $this->db_connect(TRUE);
}
// --------------------------------------------------------------------