summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-09-23 10:37:15 +0200
committerGreg Aker <greg@gregaker.net>2011-09-23 10:37:15 +0200
commit1ccbb8afa8ab5060d7bdb7a22c640302fe80d226 (patch)
treeb1d623995a34c7331b0ae6b00ba6fc0d6ac81996 /system/database/drivers/oci8
parent8ff4623fcd2d0d2fcde10831ce9fbc857eb2347a (diff)
parentb83c4088829207af39e862d6252eff393bc71642 (diff)
Merge pull request #479 from narfbg/ci-oci-insert-batch
Add $this->db->insert_batch() support to the OCI8 (Oracle) driver
Diffstat (limited to 'system/database/drivers/oci8')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php30
1 files changed, 29 insertions, 1 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 */