diff options
author | Andrey Andreev <narf@devilix.net> | 2019-11-25 10:41:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2019-11-25 10:43:19 +0100 |
commit | d44af37e883b373cac255b4881ad3eb040c85e86 (patch) | |
tree | 96f00a5fabc8180ba0f1cc6b74eba53ccf4f4bc1 /system/database/drivers/oci8 | |
parent | 58a3b738d014df293bac1e31fc40a37e5050f9ec (diff) |
[ci skip] Merge pull request #5856 from ytetsuro/fix/oracle12.1-support-auto-increment
Enhancement oracle dbforge, auto_increment can be used when using oracle 12.1.
Diffstat (limited to 'system/database/drivers/oci8')
-rw-r--r-- | system/database/drivers/oci8/oci8_forge.php | 24 |
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']; } // -------------------------------------------------------------------- |