diff options
author | Andrey Andreev <narf@devilix.net> | 2016-06-28 10:06:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 10:06:47 +0200 |
commit | 2d9e1dc24e47a57b97cbc60cdff287656474ebca (patch) | |
tree | 97e2e992ab4eaaa98cf317a237dad9c5bf53b1e8 /system/database | |
parent | d9566cd6cd3e88badde75a9c0b690cef47d1ddc1 (diff) | |
parent | 4b933ad9d24daf67e28d804b95a231a707afede3 (diff) |
Merge pull request #4678 from kenjis/fix-oci8_forge
DBForge adjustments for Oracle
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/oci8/oci8_forge.php | 37 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_oci_forge.php | 36 |
2 files changed, 69 insertions, 4 deletions
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 1ca559a32..989c7a8b7 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -54,6 +54,13 @@ class CI_DB_oci8_forge extends CI_DB_forge { protected $_create_database = FALSE; /** + * CREATE TABLE IF statement + * + * @var string + */ + protected $_create_table_if = FALSE; + + /** * DROP DATABASE statement * * @var string @@ -146,4 +153,34 @@ class CI_DB_oci8_forge extends CI_DB_forge { // Not supported - sequences and triggers must be used instead } + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'INT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'NUMBER'; + return; + default: return; + } + } + } diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php index d0b7be8f2..94a52ffc8 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -54,18 +54,18 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge { protected $_create_database = FALSE; /** - * DROP DATABASE statement + * CREATE TABLE IF statement * * @var string */ - protected $_drop_database = FALSE; + protected $_create_table_if = FALSE; /** - * CREATE TABLE IF statement + * DROP DATABASE statement * * @var string */ - protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; + protected $_drop_database = FALSE; /** * UNSIGNED support @@ -146,4 +146,32 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge { // Not supported - sequences and triggers must be used instead } + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'INT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'NUMBER'; + return; + default: return; + } + } + } |