From 26086874ebb5425a38e879018f9a654182f93b40 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Jul 2012 11:21:58 +0300 Subject: Rename the 'interbase' DB driver to 'ibase' in order to match PHP's function prefix --- system/database/drivers/ibase/ibase_driver.php | 447 +++++++++++++++++++++++++ 1 file changed, 447 insertions(+) create mode 100644 system/database/drivers/ibase/ibase_driver.php (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php new file mode 100644 index 000000000..a257e3c55 --- /dev/null +++ b/system/database/drivers/ibase/ibase_driver.php @@ -0,0 +1,447 @@ +hostname.':'.$this->database, $this->username, $this->password, $this->char_set); + } + + // -------------------------------------------------------------------- + + /** + * Persistent database connection + * + * @return resource + */ + public function db_pconnect() + { + return @ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if (($service = ibase_service_attach($this->hostname, $this->username, $this->password))) + { + $this->data_cache['version'] = ibase_server_info($service, IBASE_SVC_SERVER_VERSION); + + // Don't keep the service open + ibase_service_detach($service); + return $this->data_cache['version']; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string an SQL query + * @return resource + */ + protected function _execute($sql) + { + return @ibase_query($this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + public function trans_begin($test_mode = FALSE) + { + // When transactions are nested we only begin/commit/rollback the outermost ones + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) + { + return TRUE; + } + + // Reset the transaction failure flag. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. + $this->_trans_failure = ($test_mode === TRUE); + + $this->trans = @ibase_trans($this->conn_id); + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + public function trans_commit() + { + // When transactions are nested we only begin/commit/rollback the outermost ones + if ( ! $this->trans_enabled OR $this->_trans->depth > 0) + { + return TRUE; + } + + return @ibase_commit($this->trans); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + public function trans_rollback() + { + // When transactions are nested we only begin/commit/rollback the outermost ones + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) + { + return TRUE; + } + + return @ibase_rollback($this->trans); + } + + // -------------------------------------------------------------------- + + /** + * Escape String + * + * @param string + * @param bool whether or not the string will be used in a LIKE condition + * @return string + */ + public function escape_str($str, $like = FALSE) + { + if (is_array($str)) + { + foreach ($str as $key => $val) + { + $str[$key] = $this->escape_str($val, $like); + } + + return $str; + } + + // escape LIKE condition wildcards + if ($like === TRUE) + { + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return @ibase_affected_rows($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @param string $generator_name + * @param int $inc_by + * @return int + */ + public function insert_id($generator_name, $inc_by = 0) + { + //If a generator hasn't been used before it will return 0 + return ibase_gen_id('"'.$generator_name.'"', $inc_by); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string the table name + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT "RDB$FIELD_NAME" FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @param string the table name + * @return string + */ + protected function _field_data($table) + { + return $this->_limit('SELECT * FROM '.$this->protect_identifiers($table), 1, NULL); + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occured. + * + * @return array + */ + public function error() + { + return array('code' => ibase_errcode(), 'message' => ibase_errmsg()); + } + + // -------------------------------------------------------------------- + + /** + * From Tables + * + * This public function implicitly groups FROM tables so there is no confusion + * about operator precedence in harmony with SQL standards + * + * @param array + * @return string + */ + protected function _from_tables($tables) + { + return is_array($tables) ? implode(', ', $tables) : $tables; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string the table name + * @param array the update data + * @param array the where clause + * @param array the orderby clause + * @param array the limit clause (ignored) + * @param array the like clause + * @return string + */ + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE, $like = array()) + { + foreach ($values as $key => $val) + { + $valstr[] = $key.' = '.$val; + } + + $where = empty($where) ? '' : ' WHERE '.implode(' ', $where); + + if ( ! empty($like)) + { + $where .= ($where === '' ? ' WHERE ' : ' AND ').implode(' ', $like); + } + + return 'UPDATE '.$table.' SET '.implode(', ', $valstr) + .$where + .(count($orderby) > 0 ? ' ORDER BY '.implode(', ', $orderby) : ''); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the truncate() command, + * then this method maps to 'DELETE FROM table' + * + * @param string the table name + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string the table name + * @param array the where clause + * @param array the like clause + * @param string the limit clause (ignored) + * @return string + */ + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) + { + $conditions = array(); + + empty($where) OR $conditions[] = implode(' ', $where); + empty($like) OR $conditions[] = implode(' ', $like); + + return 'DELETE FROM '.$table.(count($conditions) > 0 ? ' WHERE '.implode(' AND ', $conditions) : ''); + } + + // -------------------------------------------------------------------- + + /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @param string the sql query string + * @param int the number of rows to limit the query to + * @param int the offset value + * @return string + */ + protected function _limit($sql, $limit, $offset) + { + // Limit clause depends on if Interbase or Firebird + if (stripos($this->version(), 'firebird') !== FALSE) + { + $select = 'FIRST '. (int) $limit + .($offset ? ' SKIP '. (int) $offset : ''); + } + else + { + $select = 'ROWS ' + .($offset ? (int) $offset.' TO '.($limit + $offset) : (int) $limit); + } + + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + @ibase_close($this->conn_id); + } + +} + +/* End of file ibase_driver.php */ +/* Location: ./system/database/drivers/ibase/ibase_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 77a5d94974f546fb5f1cb04cfca4dbdf54f1d46b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Jul 2012 15:42:14 +0300 Subject: Add a default _count_string property --- system/database/drivers/ibase/ibase_driver.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index a257e3c55..c9027670d 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -49,13 +49,7 @@ class CI_DB_ibase_driver extends CI_DB { protected $_like_escape_str = " ESCAPE '%s' "; protected $_like_escape_chr = '!'; - /** - * The syntax to count rows is slightly different across different - * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. - */ - protected $_count_string = 'SELECT COUNT(*) AS '; - protected $_random_keyword = ' Random()'; // database specific random keyword + protected $_random_keyword = ' Random()'; // database specific random keyword // Keeps track of the resource for the current transaction protected $trans; -- cgit v1.2.3-24-g4f1b From b04786599e1b032078f1d3bdd8941405d47447a0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 18 Jul 2012 15:34:46 +0300 Subject: Remove dependancies on qb_like and remove unneeded parameters from _delete(), _like(), _update(), _update_batch() --- system/database/drivers/ibase/ibase_driver.php | 36 +++++--------------------- 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index c9027670d..86c1fee6d 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -328,29 +328,12 @@ class CI_DB_ibase_driver extends CI_DB { * * @param string the table name * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause (ignored) - * @param array the like clause * @return string */ - protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE, $like = array()) + protected function _update($table, $values) { - foreach ($values as $key => $val) - { - $valstr[] = $key.' = '.$val; - } - - $where = empty($where) ? '' : ' WHERE '.implode(' ', $where); - - if ( ! empty($like)) - { - $where .= ($where === '' ? ' WHERE ' : ' AND ').implode(' ', $like); - } - - return 'UPDATE '.$table.' SET '.implode(', ', $valstr) - .$where - .(count($orderby) > 0 ? ' ORDER BY '.implode(', ', $orderby) : ''); + $this->qb_limit = FALSE; + return parent::_update($table, $values); } // -------------------------------------------------------------------- @@ -379,19 +362,12 @@ class CI_DB_ibase_driver extends CI_DB { * Generates a platform-specific delete string from the supplied data * * @param string the table name - * @param array the where clause - * @param array the like clause - * @param string the limit clause (ignored) * @return string */ - protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table) { - $conditions = array(); - - empty($where) OR $conditions[] = implode(' ', $where); - empty($like) OR $conditions[] = implode(' ', $like); - - return 'DELETE FROM '.$table.(count($conditions) > 0 ? ' WHERE '.implode(' AND ', $conditions) : ''); + $this->qb_limit = FALSE; + return parent::_delete($table); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From c9b924c1498847d8f324d81c8994fff0b95f26dc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Jul 2012 13:06:02 +0300 Subject: Remove _limit()'s extra parameters and qb_limit, qb_offset unneeded typecasts + add _compile_group_by() method --- system/database/drivers/ibase/ibase_driver.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 86c1fee6d..7b37b9999 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -285,7 +285,10 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _field_data($table) { - return $this->_limit('SELECT * FROM '.$this->protect_identifiers($table), 1, NULL); + $this->qb_limit = 1; + $sql = $this->_limit('SELECT * FROM '.$this->protect_identifiers($table)); + $this->qb_limit = 0; + return $sql; } // -------------------------------------------------------------------- @@ -378,22 +381,20 @@ class CI_DB_ibase_driver extends CI_DB { * Generates a platform-specific LIMIT clause * * @param string the sql query string - * @param int the number of rows to limit the query to - * @param int the offset value * @return string */ - protected function _limit($sql, $limit, $offset) + protected function _limit($sql) { // Limit clause depends on if Interbase or Firebird if (stripos($this->version(), 'firebird') !== FALSE) { - $select = 'FIRST '. (int) $limit - .($offset ? ' SKIP '. (int) $offset : ''); + $select = 'FIRST '.$this->qb_limit + .($this->qb_offset ? ' SKIP '.$this->qb_offset : ''); } else { $select = 'ROWS ' - .($offset ? (int) $offset.' TO '.($limit + $offset) : (int) $limit); + .($this->qb_offset ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit); } return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); -- cgit v1.2.3-24-g4f1b From 2ea33c37e9bfa3ff0e029c18a0d2c9ef05016bf0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 4 Oct 2012 12:37:51 +0300 Subject: Fix issue #1789 Signed-off-by: Andrey Andreev --- system/database/drivers/ibase/ibase_driver.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index c9027670d..f7811bf46 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -45,10 +45,6 @@ class CI_DB_ibase_driver extends CI_DB { // The character used to escape with protected $_escape_char = '"'; - // clause and character used for LIKE escape sequences - protected $_like_escape_str = " ESCAPE '%s' "; - protected $_like_escape_chr = '!'; - protected $_random_keyword = ' Random()'; // database specific random keyword // Keeps track of the resource for the current transaction -- cgit v1.2.3-24-g4f1b From cd50592b26a26a2e55fc193529a2463d9a465378 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 6 Oct 2012 21:27:01 +0300 Subject: Fix issue #1257 --- system/database/drivers/ibase/ibase_driver.php | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index f7811bf46..ab1d1b88d 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -301,22 +301,6 @@ class CI_DB_ibase_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * From Tables - * - * This public function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @param array - * @return string - */ - protected function _from_tables($tables) - { - return is_array($tables) ? implode(', ', $tables) : $tables; - } - - // -------------------------------------------------------------------- - /** * Update statement * -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/database/drivers/ibase/ibase_driver.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 96d6f6526..c3be519bf 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -116,6 +116,7 @@ class CI_DB_ibase_driver extends CI_DB { /** * Begin Transaction * + * @param bool $test_mode = FALSE * @return bool */ public function trans_begin($test_mode = FALSE) -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/database/drivers/ibase/ibase_driver.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index c3be519bf..3b5d8f4c6 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -1,4 +1,4 @@ - Date: Fri, 2 Nov 2012 03:54:12 +0200 Subject: [ci skip] DocBlocks for DB drivers' driver classes Partially fixes issue #1295. --- system/database/drivers/ibase/ibase_driver.php | 59 ++++++++++++++++---------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 3b5d8f4c6..fc1c28f31 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -41,15 +41,30 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_DB_ibase_driver extends CI_DB { + /** + * Database driver + * + * @var string + */ public $dbdriver = 'ibase'; - // The character used to escape with - protected $_escape_char = '"'; + // -------------------------------------------------------------------- + + /** + * ORDER BY random keyword + * + * @var string + */ + protected $_random_keyword = ' Random()'; - protected $_random_keyword = ' Random()'; // database specific random keyword + /** + * IBase Transaction status flag + * + * @var resource + */ + protected $_ibase_trans; - // Keeps track of the resource for the current transaction - protected $trans; + // -------------------------------------------------------------------- /** * Non-persistent database connection @@ -104,7 +119,7 @@ class CI_DB_ibase_driver extends CI_DB { /** * Execute the query * - * @param string an SQL query + * @param string $sql an SQL query * @return resource */ protected function _execute($sql) @@ -117,7 +132,7 @@ class CI_DB_ibase_driver extends CI_DB { /** * Begin Transaction * - * @param bool $test_mode = FALSE + * @param bool $test_mode * @return bool */ public function trans_begin($test_mode = FALSE) @@ -133,7 +148,7 @@ class CI_DB_ibase_driver extends CI_DB { // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE); - $this->trans = @ibase_trans($this->conn_id); + $this->_ibase_trans = @ibase_trans($this->conn_id); return TRUE; } @@ -153,7 +168,7 @@ class CI_DB_ibase_driver extends CI_DB { return TRUE; } - return @ibase_commit($this->trans); + return @ibase_commit($this->_ibase_trans); } // -------------------------------------------------------------------- @@ -171,7 +186,7 @@ class CI_DB_ibase_driver extends CI_DB { return TRUE; } - return @ibase_rollback($this->trans); + return @ibase_rollback($this->_ibase_trans); } // -------------------------------------------------------------------- @@ -179,8 +194,8 @@ class CI_DB_ibase_driver extends CI_DB { /** * Escape String * - * @param string - * @param bool whether or not the string will be used in a LIKE condition + * @param string $str + * @param bool $like Whether or not the string will be used in a LIKE condition * @return string */ public function escape_str($str, $like = FALSE) @@ -240,7 +255,7 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @param bool + * @param bool $prefix_limit * @return string */ protected function _list_tables($prefix_limit = FALSE) @@ -263,7 +278,7 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @param string the table name + * @param string $table * @return string */ protected function _list_columns($table = '') @@ -278,7 +293,7 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @param string the table name + * @param string $table * @return string */ protected function _field_data($table) @@ -311,8 +326,8 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @param string the table name - * @param array the update data + * @param string $table + * @param array $values * @return string */ protected function _update($table, $values) @@ -328,10 +343,10 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * - * If the database does not support the truncate() command, + * If the database does not support the TRUNCATE statement, * then this method maps to 'DELETE FROM table' * - * @param string the table name + * @param string $table * @return string */ protected function _truncate($table) @@ -346,7 +361,7 @@ class CI_DB_ibase_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @param string the table name + * @param string $table * @return string */ protected function _delete($table) @@ -358,11 +373,11 @@ class CI_DB_ibase_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Limit string + * LIMIT * * Generates a platform-specific LIMIT clause * - * @param string the sql query string + * @param string $sql SQL Query * @return string */ protected function _limit($sql) -- cgit v1.2.3-24-g4f1b From 98e46cf96447a2a6448d8dc984948a8694dbf747 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 13 Nov 2012 03:01:42 +0200 Subject: Add seed values support for Query Builder order_by (feature request #1987) --- system/database/drivers/ibase/ibase_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index fc1c28f31..02ec354e3 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -53,9 +53,9 @@ class CI_DB_ibase_driver extends CI_DB { /** * ORDER BY random keyword * - * @var string + * @var array */ - protected $_random_keyword = ' Random()'; + protected $_random_keyword = array('RAND()', 'RAND()'); /** * IBase Transaction status flag -- cgit v1.2.3-24-g4f1b From 02e7a9d6509092315dd31183762616860ebb9621 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 16 Nov 2012 01:49:46 +0200 Subject: Improve DB field_data() for Interbase / Firebird --- system/database/drivers/ibase/ibase_driver.php | 45 ++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 02ec354e3..15c2a4630 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -289,19 +289,46 @@ class CI_DB_ibase_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved + * Returns an object with field data * * @param string $table - * @return string + * @return array */ - protected function _field_data($table) + public function field_data($table = '') { - $this->qb_limit = 1; - $sql = $this->_limit('SELECT * FROM '.$this->protect_identifiers($table)); - $this->qb_limit = 0; - return $sql; + if ($table === '') + { + return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; + } + + $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name", + CASE "fields"."RDB$FIELD_TYPE" + WHEN 7 THEN \'SMALLINT\' + WHEN 8 THEN \'INTEGER\' + WHEN 9 THEN \'QUAD\' + WHEN 10 THEN \'FLOAT\' + WHEN 11 THEN \'DFLOAT\' + WHEN 12 THEN \'DATE\' + WHEN 13 THEN \'TIME\' + WHEN 14 THEN \'CHAR\' + WHEN 16 THEN \'INT64\' + WHEN 27 THEN \'DOUBLE\' + WHEN 35 THEN \'TIMESTAMP\' + WHEN 37 THEN \'VARCHAR\' + WHEN 40 THEN \'CSTRING\' + WHEN 261 THEN \'BLOB\' + ELSE NULL + END AS "type", + "fields"."RDB$FIELD_LENGTH" AS "max_length", + "rfields"."RDB$DEFAULT_VALUE" AS "default" + FROM "RDB$RELATION_FIELDS" "rfields" + JOIN "RDB$FIELDS" "fields" ON "rfields"."RDB$FIELD_SOURCE" = "fields"."RDB$FIELD_NAME" + WHERE "rfields"."RDB$RELATION_NAME" = '.$this->escape($table).' + ORDER BY "rfields"."RDB$FIELD_POSITION"'; + + return (($query = $this->query($sql)) !== FALSE) + ? $query->result_object() + : FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 15c2a4630..87faf3d08 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 3.0 -- cgit v1.2.3-24-g4f1b From a541087a6fb44b24f8d7044277391f282a326220 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 9 Jan 2013 10:44:14 -0500 Subject: Fix interbase limit issue for subqueries --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 87faf3d08..875f148a1 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -421,7 +421,7 @@ class CI_DB_ibase_driver extends CI_DB { .($this->qb_offset ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit); } - return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql, 1); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 0b6a492ce1092172b9e3445e674ff9a344d33650 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 10 Jan 2013 16:53:44 +0200 Subject: Unify escape_str() array input and LIKE logic Added protected method _escape_str() to deal with quote escaping. --- system/database/drivers/ibase/ibase_driver.php | 32 -------------------------- 1 file changed, 32 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 875f148a1..745011056 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -191,38 +191,6 @@ class CI_DB_ibase_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Escape String - * - * @param string $str - * @param bool $like Whether or not the string will be used in a LIKE condition - * @return string - */ - public function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach ($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - // escape LIKE condition wildcards - if ($like === TRUE) - { - return str_replace(array($this->_like_escape_chr, '%', '_'), - array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - /** * Affected Rows * -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 745011056..4cff5f448 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 3.0 -- cgit v1.2.3-24-g4f1b From 2e171023bae38735ec08bbd9cb160cee75edbc62 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 25 Feb 2014 15:21:41 +0200 Subject: Make db_pconnect an alias for db_connect(TRUE) and reduce code repetition --- system/database/drivers/ibase/ibase_driver.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 4cff5f448..c85b19955 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -69,23 +69,14 @@ class CI_DB_ibase_driver extends CI_DB { /** * Non-persistent database connection * + * @param bool $persistent * @return resource */ - public function db_connect() + public function db_connect($persistent = FALSE) { - return @ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @return resource - */ - public function db_pconnect() - { - return @ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); + return ($persistent === TRUE) + ? @ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set) + : @ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From f2818bd9b9be242a1c53ee839a95962a682a2e93 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 25 Feb 2014 15:26:20 +0200 Subject: Remove error suppression usage from db_connect() --- system/database/drivers/ibase/ibase_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index c85b19955..b9eabd00e 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -75,8 +75,8 @@ class CI_DB_ibase_driver extends CI_DB { public function db_connect($persistent = FALSE) { return ($persistent === TRUE) - ? @ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set) - : @ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); + ? ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set) + : ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 2bbbd1a13ead097fd3f4b00bfb275f0b0f836f93 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 May 2014 10:24:14 +0300 Subject: Remove (most of) error suppression from database drivers (issue #3036) --- system/database/drivers/ibase/ibase_driver.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index b9eabd00e..b19985c37 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -115,7 +115,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _execute($sql) { - return @ibase_query($this->conn_id, $sql); + return ibase_query($this->conn_id, $sql); } // -------------------------------------------------------------------- @@ -139,7 +139,7 @@ class CI_DB_ibase_driver extends CI_DB { // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE); - $this->_ibase_trans = @ibase_trans($this->conn_id); + $this->_ibase_trans = ibase_trans($this->conn_id); return TRUE; } @@ -159,7 +159,7 @@ class CI_DB_ibase_driver extends CI_DB { return TRUE; } - return @ibase_commit($this->_ibase_trans); + return ibase_commit($this->_ibase_trans); } // -------------------------------------------------------------------- @@ -177,7 +177,7 @@ class CI_DB_ibase_driver extends CI_DB { return TRUE; } - return @ibase_rollback($this->_ibase_trans); + return ibase_rollback($this->_ibase_trans); } // -------------------------------------------------------------------- @@ -189,7 +189,7 @@ class CI_DB_ibase_driver extends CI_DB { */ public function affected_rows() { - return @ibase_affected_rows($this->conn_id); + return ibase_affected_rows($this->conn_id); } // -------------------------------------------------------------------- @@ -392,7 +392,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _close() { - @ibase_close($this->conn_id); + ibase_close($this->conn_id); } } -- cgit v1.2.3-24-g4f1b From d07daa54d991e38ccdcf41c4f9d90f307c5ecbc1 Mon Sep 17 00:00:00 2001 From: hArpanet Date: Thu, 21 Aug 2014 11:26:42 +0100 Subject: ibase_driver returning whitespace in table/column names Currently all Table and Field names are returned padded with whitespace up to string(124). --- system/database/drivers/ibase/ibase_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index b19985c37..8f10c1f1d 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -219,11 +219,11 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + $sql = 'SELECT TRIM("RDB$RELATION_NAME") FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; if ($prefix_limit !== FALSE && $this->dbprefix !== '') { - return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + return $sql.' AND TRIM("RDB$RELATION_NAME") LIKE \''.$this->escape_like_str($this->dbprefix)."%' " .sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -242,7 +242,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _list_columns($table = '') { - return 'SELECT "RDB$FIELD_NAME" FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); + return 'SELECT TRIM("RDB$FIELD_NAME") FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 516f59c855c969cfcdbc83bb1a2f4180e8cf9271 Mon Sep 17 00:00:00 2001 From: hArpanet Date: Tue, 26 Aug 2014 09:46:52 +0100 Subject: ibase_driver add table/column aliases to satisfy DB_driver expectations --- system/database/drivers/ibase/ibase_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 8f10c1f1d..f4e5aef7c 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -219,11 +219,11 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SELECT TRIM("RDB$RELATION_NAME") FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + $sql = 'SELECT TRIM("RDB$RELATION_NAME") AS TABLE_NAME FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; if ($prefix_limit !== FALSE && $this->dbprefix !== '') { - return $sql.' AND TRIM("RDB$RELATION_NAME") LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + return $sql.' AND TRIM("RDB$RELATION_NAME") AS TABLE_NAME LIKE \''.$this->escape_like_str($this->dbprefix)."%' " .sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -242,7 +242,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _list_columns($table = '') { - return 'SELECT TRIM("RDB$FIELD_NAME") FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); + return 'SELECT TRIM("RDB$FIELD_NAME") AS COLUMN_NAME FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/database/drivers/ibase/ibase_driver.php | 39 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index f4e5aef7c..d6e0032d4 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 3.0 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/database/drivers/ibase/ibase_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index d6e0032d4..aac606886 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 3.0.0 -- cgit v1.2.3-24-g4f1b From 5350f056698168061ffde1ba62e8db1715101446 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Jan 2015 12:33:37 +0200 Subject: Change CI_DB_driver::field_data() signature The parameter is mandatory, it doesn't make sense to have a default empty string value only to check for it. --- system/database/drivers/ibase/ibase_driver.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index aac606886..20c5d9c57 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -264,13 +264,8 @@ class CI_DB_ibase_driver extends CI_DB { * @param string $table * @return array */ - public function field_data($table = '') + public function field_data($table) { - if ($table === '') - { - return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; - } - $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name", CASE "fields"."RDB$FIELD_TYPE" WHEN 7 THEN \'SMALLINT\' -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/database/drivers/ibase/ibase_driver.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 20c5d9c57..529c320cd 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -402,6 +402,3 @@ class CI_DB_ibase_driver extends CI_DB { } } - -/* End of file ibase_driver.php */ -/* Location: ./system/database/drivers/ibase/ibase_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From a7d4abaedc27497d570ae06ddc9cdde05930ec15 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 19 Oct 2015 14:39:44 +0300 Subject: Fix #4171 and a number of other transaction bugs --- system/database/drivers/ibase/ibase_driver.php | 32 ++++++++++---------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 529c320cd..82550d51b 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -134,24 +134,16 @@ class CI_DB_ibase_driver extends CI_DB { /** * Begin Transaction * - * @param bool $test_mode * @return bool */ - public function trans_begin($test_mode = FALSE) + protected function _trans_begin() { - // When transactions are nested we only begin/commit/rollback the outermost ones - if ( ! $this->trans_enabled OR $this->_trans_depth > 0) + if (($trans_handle = ibase_trans($this->conn_id)) === FALSE) { - return TRUE; + return FALSE; } - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE); - - $this->_ibase_trans = ibase_trans($this->conn_id); - + $this->_ibase_trans = $trans_handle; return TRUE; } @@ -162,15 +154,15 @@ class CI_DB_ibase_driver extends CI_DB { * * @return bool */ - public function trans_commit() + protected function _trans_commit() { - // When transactions are nested we only begin/commit/rollback the outermost ones - if ( ! $this->trans_enabled OR $this->_trans->depth > 0) + if (ibase_commit($this->_ibase_trans)) { + $this->_ibase_trans = NULL; return TRUE; } - return ibase_commit($this->_ibase_trans); + return FALSE; } // -------------------------------------------------------------------- @@ -180,15 +172,15 @@ class CI_DB_ibase_driver extends CI_DB { * * @return bool */ - public function trans_rollback() + protected function _trans_rollback() { - // When transactions are nested we only begin/commit/rollback the outermost ones - if ( ! $this->trans_enabled OR $this->_trans_depth > 0) + if (ibase_rollback($this->_ibase_trans)) { + $this->_ibase_trans = NULL; return TRUE; } - return ibase_rollback($this->_ibase_trans); + return FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/database/drivers/ibase/ibase_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 82550d51b..6b1c77b7f 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 3.0.0 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/database/drivers/ibase/ibase_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 6b1c77b7f..f1b89b748 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 3.0.0 * @filesource */ @@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Drivers * @category Database * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/user_guide/database/ */ class CI_DB_ibase_driver extends CI_DB { -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index f1b89b748..cbc1022ff 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From 8108b612fb80327215ae66b53c75c158d6f07e62 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 7 Mar 2016 10:10:17 +0200 Subject: [ci skip] Fix transactions for the ibase driver Reported via the forums: http://forum.codeigniter.com/thread-64559.html --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index cbc1022ff..c1055c1e6 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -126,7 +126,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _execute($sql) { - return ibase_query($this->conn_id, $sql); + return ibase_query(isset($this->_ibase_trans) ? $this->_ibase_trans : $this->conn_id, $sql); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 0a4dd844b8a3d6edb7712d3bb4edf1b4f0e9dc4c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 16 Sep 2016 12:06:40 +0300 Subject: [ci skip] Don't try to insert_batch() when we know it's not supported on Firebird --- system/database/drivers/ibase/ibase_driver.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index c1055c1e6..671a353bc 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -383,6 +383,23 @@ class CI_DB_ibase_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + /** * Close DB Connection * -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/database/drivers/ibase/ibase_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 671a353bc..106d5efac 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 -- cgit v1.2.3-24-g4f1b From 71d8f72ffc48a7f46747b3b6b1a554533cc1cbc5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 17 Jan 2017 12:01:00 +0200 Subject: [ci skip] Merge pull request #4986 from ka7/feature/spelling Spelling fixes in comment blocks and docs --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 106d5efac..fea3bfe52 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -294,7 +294,7 @@ class CI_DB_ibase_driver extends CI_DB { * Error * * Returns an array containing code and message of the last - * database error that has occured. + * database error that has occurred. * * @return array */ -- cgit v1.2.3-24-g4f1b From ea0735264dfebd64858933e03a3b33323b14178e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 14 Mar 2017 18:42:12 +0200 Subject: Fix #5050 --- system/database/drivers/ibase/ibase_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/ibase/ibase_driver.php') diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index fea3bfe52..3069d6699 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -395,7 +395,7 @@ class CI_DB_ibase_driver extends CI_DB { */ protected function _insert_batch($table, $keys, $values) { - return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b