summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorytetsuro <phper.0o0@gmail.com>2019-10-14 10:17:26 +0200
committerytetsuro <phper.0o0@gmail.com>2019-10-14 10:17:26 +0200
commit092da7f915e283ca554bfa2149f9edead75d4031 (patch)
tree26694c38ad1ec67ad744c63ab07ffd0109e72772 /system/database
parent92fc1c0f5a08e396f2e008f32331214db0ece727 (diff)
feat: support auto_increment for orace 12.1
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/oci8/oci8_forge.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 58f3c3913..a73899888 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -159,7 +159,29 @@ class CI_DB_oci8_forge extends CI_DB_forge {
*/
protected function _attr_auto_increment(&$attributes, &$field)
{
- // Not supported - sequences and triggers must be used instead
+ if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'number') !== FALSE && version_compare($this->db->version(), '12.1', '>='))
+ {
+ $field['auto_increment'] = ' GENERATED ALWAYS AS IDENTITY';
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Process column
+ *
+ * @param array $field
+ * @return string
+ */
+ protected function _process_column($field)
+ {
+ return $this->db->escape_identifiers($field['name'])
+ .' '.$field['type'].$field['length']
+ .$field['unsigned']
+ .$field['default']
+ .$field['auto_increment']
+ .$field['null']
+ .$field['unique'];
}
// --------------------------------------------------------------------