diff options
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 30 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_result.php | 17 | ||||
-rw-r--r-- | user_guide/changelog.html | 2 | ||||
-rw-r--r-- | user_guide/database/forge.html | 4 |
4 files changed, 45 insertions, 8 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index d4c27fa43..1cf063ec1 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -643,6 +643,34 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** + * Insert_batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert_batch($table, $keys, $values) + { + $keys = implode(', ', $keys); + $sql = "INSERT ALL\n"; + + for ($i = 0, $c = count($values); $i < $c; $i++) + { + $sql .= ' INTO ' . $table . ' (' . $keys . ') VALUES ' . $values[$i] . "\n"; + } + + $sql .= 'SELECT * FROM dual'; + + return $sql; + } + + // -------------------------------------------------------------------- + + /** * Update statement * * Generates a platform-specific update string from the supplied data @@ -776,4 +804,4 @@ class CI_DB_oci8_driver extends CI_DB { /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */
\ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 88531b436..2713f6f12 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -42,15 +42,18 @@ class CI_DB_oci8_result extends CI_DB_result { */ function num_rows() { - $rowcount = count($this->result_array()); - @ociexecute($this->stmt_id); - - if ($this->curs_id) + if ($this->num_rows === 0 && count($this->result_array()) > 0) { - @ociexecute($this->curs_id); + $this->num_rows = count($this->result_array()); + @ociexecute($this->stmt_id); + + if ($this->curs_id) + { + @ociexecute($this->curs_id); + } } - return $rowcount; + return $this->num_rows; } // -------------------------------------------------------------------- @@ -246,4 +249,4 @@ class CI_DB_oci8_result extends CI_DB_result { /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */
\ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_result.php */ diff --git a/user_guide/changelog.html b/user_guide/changelog.html index b9c1b6094..7ff2af2f5 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -91,6 +91,7 @@ Change Log <li> Added additional option 'none' for the optional third argument for <kbd>$this->db->like()</kbd> in the <a href="database/active_record.html">Database Driver</a>. </li> + <li>Added <kbd>$this->db->insert_batch()</kbd> support to the OCI8 (Oracle) driver.</li> </ul> </li> <li>Libraries @@ -130,6 +131,7 @@ Change Log <li>Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.</li> <li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li> <li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li> + <li>Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.</li> </ul> <h2>Version 2.0.3</h2> diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index 6b8709892..528d1a24c 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -201,6 +201,10 @@ already be running, since the forge class relies on it.</p> $this->dbforge->add_column('table_name', $fields);<br /> <br /> // gives ALTER TABLE table_name ADD preferences TEXT</code></p> +<p>An optional third parameter can be used to specify which existing column to add the new column after.</p> +<p><code> +$this->dbforge->add_column('table_name', $fields, 'after_field'); +</code></p> <h2>$this->dbforge->drop_column()</h2> <p>Used to remove a column from a table. </p> <p><code>$this->dbforge->drop_column('table_name', 'column_to_drop');</code></p> |