From 11c5f1654d2d13113ad06da46f560628d7e31dd3 Mon Sep 17 00:00:00 2001 From: Aaron Kuzemchak Date: Sat, 3 Sep 2011 20:59:07 -0400 Subject: Enables real page numbers for URI segment in Pagination library --- system/libraries/Pagination.php | 85 +++++++++++++++++++++++++++++++----- user_guide/libraries/pagination.html | 6 ++- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index cc62e660b..cdaacf2d4 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -34,6 +34,7 @@ class CI_Pagination { var $per_page = 10; // Max number of items you want shown per page var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page var $cur_page = 0; // The current page being viewed + var $use_page_numbers = FALSE; // Use page number for segment instead of offset var $first_link = '‹ First'; var $next_link = '>'; var $prev_link = '<'; @@ -128,12 +129,22 @@ class CI_Pagination { return ''; } + // Set the base page index for starting page number + if ($this->use_page_numbers) + { + $base_page = 1; + } + else + { + $base_page = 0; + } + // Determine the current page number. $CI =& get_instance(); if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) { - if ($CI->input->get($this->query_string_segment) != 0) + if ($CI->input->get($this->query_string_segment) != $base_page) { $this->cur_page = $CI->input->get($this->query_string_segment); @@ -143,7 +154,7 @@ class CI_Pagination { } else { - if ($CI->uri->segment($this->uri_segment) != 0) + if ($CI->uri->segment($this->uri_segment) != $base_page) { $this->cur_page = $CI->uri->segment($this->uri_segment); @@ -151,6 +162,12 @@ class CI_Pagination { $this->cur_page = (int) $this->cur_page; } } + + // Set current page to 1 if using page numbers instead of offset + if ($this->use_page_numbers AND $this->cur_page == 0) + { + $this->cur_page = $base_page; + } $this->num_links = (int)$this->num_links; @@ -161,18 +178,32 @@ class CI_Pagination { if ( ! is_numeric($this->cur_page)) { - $this->cur_page = 0; + $this->cur_page = $base_page; } // Is the page number beyond the result range? // If so we show the last page - if ($this->cur_page > $this->total_rows) + if ($this->use_page_numbers) { - $this->cur_page = ($num_pages - 1) * $this->per_page; + if ($this->cur_page > $num_pages) + { + $this->cur_page = $num_pages; + } + } + else + { + if ($this->cur_page > $this->total_rows) + { + $this->cur_page = ($num_pages - 1) * $this->per_page; + } } $uri_page_number = $this->cur_page; - $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); + + if ( ! $this->use_page_numbers) + { + $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); + } // Calculate the start and end numbers. These determine // which number to start and end the digit links with @@ -203,7 +234,14 @@ class CI_Pagination { // Render the "previous" link if ($this->prev_link !== FALSE AND $this->cur_page != 1) { - $i = $uri_page_number - $this->per_page; + if ($this->use_page_numbers) + { + $i = $uri_page_number - 1; + } + else + { + $i = $uri_page_number - $this->per_page; + } if ($i == 0 && $this->first_url != '') { @@ -223,9 +261,16 @@ class CI_Pagination { // Write the digit links for ($loop = $start -1; $loop <= $end; $loop++) { - $i = ($loop * $this->per_page) - $this->per_page; + if ($this->use_page_numbers) + { + $i = $loop; + } + else + { + $i = ($loop * $this->per_page) - $this->per_page; + } - if ($i >= 0) + if ($i >= $base_page) { if ($this->cur_page == $loop) { @@ -233,7 +278,7 @@ class CI_Pagination { } else { - $n = ($i == 0) ? '' : $i; + $n = ($i == $base_page) ? '' : $i; if ($n == '' && $this->first_url != '') { @@ -253,13 +298,29 @@ class CI_Pagination { // Render the "next" link if ($this->next_link !== FALSE AND $this->cur_page < $num_pages) { - $output .= $this->next_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.''.$this->next_tag_close; + if ($this->use_page_numbers) + { + $i = $this->cur_page + 1; + } + else + { + $i = ($this->cur_page * $this->per_page); + } + + $output .= $this->next_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->next_link.''.$this->next_tag_close; } // Render the "Last" link if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) { - $i = (($num_pages * $this->per_page) - $this->per_page); + if ($this->use_page_numbers) + { + $i = $num_pages; + } + else + { + $i = (($num_pages * $this->per_page) - $this->per_page); + } $output .= $this->last_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.''.$this->last_tag_close; } diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 196555441..6a144114d 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -119,7 +119,11 @@ something different you can specify it.

The number of "digit" links you would like before and after the selected page number. For example, the number 2 will place two digits on either side, as in the example links at the very top of this page.

-

$config['page_query_string'] = TRUE

+ +

$config['use_page_numbers'] = TRUE;

+

By default, the URI segment will use the starting index for the items you are paginating. If you prefer to show the the actual page number, set this to TRUE.

+ +

$config['page_query_string'] = TRUE;

By default, the pagination library assume you are using URI Segments, and constructs your links something like

http://example.com/index.php/test/page/20

If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.

-- cgit v1.2.3-24-g4f1b From a5e13f9bf78e0cf139b905d131075a146430ce0a Mon Sep 17 00:00:00 2001 From: Aaron Kuzemchak Date: Sun, 4 Sep 2011 16:39:47 -0400 Subject: utilizing ternary syntax to clean up some conditionals --- system/libraries/Pagination.php | 46 ++++++----------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index cdaacf2d4..f190d55fd 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -130,14 +130,7 @@ class CI_Pagination { } // Set the base page index for starting page number - if ($this->use_page_numbers) - { - $base_page = 1; - } - else - { - $base_page = 0; - } + $base_page = ($this->use_page_numbers) ? 1 : 0; // Determine the current page number. $CI =& get_instance(); @@ -234,14 +227,7 @@ class CI_Pagination { // Render the "previous" link if ($this->prev_link !== FALSE AND $this->cur_page != 1) { - if ($this->use_page_numbers) - { - $i = $uri_page_number - 1; - } - else - { - $i = $uri_page_number - $this->per_page; - } + $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; if ($i == 0 && $this->first_url != '') { @@ -261,14 +247,7 @@ class CI_Pagination { // Write the digit links for ($loop = $start -1; $loop <= $end; $loop++) { - if ($this->use_page_numbers) - { - $i = $loop; - } - else - { - $i = ($loop * $this->per_page) - $this->per_page; - } + $i = ($this->use_page_numbers) ? $loop : ($loop * $this->per_page) - $this->per_page; if ($i >= $base_page) { @@ -298,14 +277,7 @@ class CI_Pagination { // Render the "next" link if ($this->next_link !== FALSE AND $this->cur_page < $num_pages) { - if ($this->use_page_numbers) - { - $i = $this->cur_page + 1; - } - else - { - $i = ($this->cur_page * $this->per_page); - } + $i = ($this->use_page_numbers) ? $this->cur_page + 1 : $this->cur_page * $this->per_page; $output .= $this->next_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->next_link.''.$this->next_tag_close; } @@ -313,14 +285,8 @@ class CI_Pagination { // Render the "Last" link if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) { - if ($this->use_page_numbers) - { - $i = $num_pages; - } - else - { - $i = (($num_pages * $this->per_page) - $this->per_page); - } + $i = ($this->use_page_numbers) ? $num_pages : ($num_pages * $this->per_page) - $this->per_page; + $output .= $this->last_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.''.$this->last_tag_close; } -- cgit v1.2.3-24-g4f1b From 6f5b52bfd80319c3bba3ae57fb636df3890fe8f7 Mon Sep 17 00:00:00 2001 From: mmestrovic Date: Wed, 14 Sep 2011 01:26:15 +0300 Subject: Added link: "Upgrading from 2.0.3 to 2.1.0" --- user_guide/installation/upgrading.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html index 58a45ee9d..0f4a29bfd 100644 --- a/user_guide/installation/upgrading.html +++ b/user_guide/installation/upgrading.html @@ -60,6 +60,7 @@ Upgrading from a Previous Version

Please read the upgrade notes corresponding to the version you are upgrading from.

    +
  • Upgrading from 2.0.3 to 2.1.0
  • Upgrading from 2.0.2 to 2.0.3
  • Upgrading from 2.0.1 to 2.0.2
  • Upgrading from 2.0 to 2.0.1
  • -- cgit v1.2.3-24-g4f1b From 45697901e4a44ecf1411a21a6014c8ff16e20c91 Mon Sep 17 00:00:00 2001 From: saintnicster Date: Wed, 14 Sep 2011 16:30:21 -0500 Subject: Copied into GitHub from @kenjis 's bitbucket repo.https://bitbucket.org/kenjis/ci-user-guide/changeset/3d579dd14afe --- user_guide/database/active_record.html | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 10259a4af..70aecbdb5 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -543,7 +543,7 @@ $data = array(
       )
    );

    -$this->db->update_batch('mytable', $data); +$this->db->insert_batch('mytable', $data);

    // Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date') @@ -666,6 +666,41 @@ You can optionally pass this information directly into the update function as a

    You may also use the $this->db->set() function described above when performing updates.

    +

    $this->db->update_batch();

    +

    Generates an update string based on the data you supply, and runs the query. You can either pass an +array or an object to the function. Here is an example using an array:

    + + +$data = array(
    +   array(
    +      'title' => 'My title' ,
    +      'name' => 'My Name 2' ,
    +      'date' => 'My date 2'
    +   ),
    +   array(
    +      'title' => 'Another title' ,
    +      'name' => 'Another Name 2' ,
    +      'date' => 'Another date 2'
    +   )
    +);
    +
    +$this->db->update_batch('mytable', $data, 'title'); +

    +// Produces:
    +// UPDATE `mytable` SET `name` = CASE
    +// WHEN `title` = 'My title' THEN 'My Name 2'
    +// WHEN `title` = 'Another title' THEN 'Another Name 2'
    +// ELSE `name` END,
    +// `date` = CASE
    +// WHEN `title` = 'My title' THEN 'My date 2'
    +// WHEN `title` = 'Another title' THEN 'Another date 2'
    +// ELSE `date` END
    +// WHERE `title` IN ('My title','Another title')
    + +

    The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.

    + +

    Note: All values are escaped automatically producing safer queries.

    +  

    Deleting Data

    -- cgit v1.2.3-24-g4f1b From 068e3dea797351448f743b1e3faac506bc0f6e2a Mon Sep 17 00:00:00 2001 From: narfbg Date: Sat, 17 Sep 2011 21:38:46 +0300 Subject: Fix ./system/database/drivers/oci8_driver.php to pass the configured database character set on connect. --- system/database/drivers/oci8/oci8_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index d4adfd528..d4c27fa43 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -79,7 +79,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function db_connect() { - return @ocilogon($this->username, $this->password, $this->hostname); + return @ocilogon($this->username, $this->password, $this->hostname, $this->char_set); } // -------------------------------------------------------------------- @@ -92,7 +92,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function db_pconnect() { - return @ociplogon($this->username, $this->password, $this->hostname); + return @ociplogon($this->username, $this->password, $this->hostname, $this->char_set); } // -------------------------------------------------------------------- @@ -136,7 +136,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function db_set_charset($charset, $collation) { - // @todo - add support if needed + // this is done upon connect return TRUE; } -- cgit v1.2.3-24-g4f1b From badaf2f3389502f02e086f7e34818ad52065213b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 17 Sep 2011 21:58:21 +0300 Subject: Update the ChangeLog --- user_guide/changelog.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 8dd64a3a2..b86204438 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -91,6 +91,7 @@ Change Log
  • Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver.
  • +
  • Added support for the configured database character set in OCI8 driver.
  • Libraries -- cgit v1.2.3-24-g4f1b From 4f04b81bb03587cf8c81513b18fa08c27dba8352 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 17 Sep 2011 22:01:14 +0300 Subject: Updated ChangeLog. --- user_guide/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index b86204438..8a4a70642 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -91,7 +91,6 @@ Change Log
  • Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver.
  • -
  • Added support for the configured database character set in OCI8 driver.
  • Libraries @@ -129,6 +128,7 @@ Change Log
  • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
  • +
  • Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 539dcb0b2968a2d83c16b42a20252011152f2e65 Mon Sep 17 00:00:00 2001 From: "Cloudmanic Labs, LLC" Date: Sun, 18 Sep 2011 12:08:56 -0700 Subject: Added support to select the name of the database table you are going to use in Migrations --- application/config/migration.php | 13 +++++++++++++ system/libraries/Migration.php | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index dba870010..aca052d0c 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -11,6 +11,19 @@ */ $config['migration_enabled'] = FALSE; +/* +|-------------------------------------------------------------------------- +| Migrations table +|-------------------------------------------------------------------------- +| +| This is the name of the table that will store the current migrations state. +| When migrations runs it will store in a database table which migration +| level the system is at. It then compares the migration level in the this +| table to the $config['migration_version'] if they are not the same it +| will migrate up. This must be set. +| +*/ +$config['migration_table'] = 'migrations'; /* |-------------------------------------------------------------------------- diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 3734e18f5..682d90752 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -32,7 +32,8 @@ class CI_Migration { protected $_migration_enabled = FALSE; protected $_migration_path = NULL; protected $_migration_version = 0; - + protected $_migration_table = 'migrations'; + protected $_error_string = ''; public function __construct($config = array()) @@ -68,16 +69,22 @@ class CI_Migration { // They'll probably be using dbforge $this->load->dbforge(); + // Make sure the migration table name was set. + if ( (! isset($this->_migration_table)) OR (empty($this->_migration_table))) + { + show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); + } + // If the migrations table is missing, make it - if ( ! $this->db->table_exists('migrations')) + if ( ! $this->db->table_exists($this->_migration_table)) { $this->dbforge->add_field(array( 'version' => array('type' => 'INT', 'constraint' => 3), )); - $this->dbforge->create_table('migrations', TRUE); + $this->dbforge->create_table($this->_migration_table, TRUE); - $this->db->insert('migrations', array('version' => 0)); + $this->db->insert($this->_migration_table, array('version' => 0)); } } @@ -299,7 +306,7 @@ class CI_Migration { */ protected function _get_version() { - $row = $this->db->get('migrations')->row(); + $row = $this->db->get($this->_migration_table)->row(); return $row ? $row->version : 0; } @@ -314,7 +321,7 @@ class CI_Migration { */ protected function _update_version($migrations) { - return $this->db->update('migrations', array( + return $this->db->update($this->_migration_table, array( 'version' => $migrations )); } -- cgit v1.2.3-24-g4f1b From d1ba8f790eb91deb2898ff19d7827ce86e40ee7c Mon Sep 17 00:00:00 2001 From: "Cloudmanic Labs, LLC" Date: Sun, 18 Sep 2011 12:23:00 -0700 Subject: Migrations: Added a config that allows the system to migration to the latest migration when you load the library. This way you do not have to call migrations anywhere else in your code and can always be at the latest migration --- application/config/migration.php | 16 ++++++++++++++++ system/libraries/Migration.php | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/application/config/migration.php b/application/config/migration.php index aca052d0c..1f532f170 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -25,6 +25,22 @@ $config['migration_enabled'] = FALSE; */ $config['migration_table'] = 'migrations'; + +/* +|-------------------------------------------------------------------------- +| Auto Migrate To Latest +|-------------------------------------------------------------------------- +| +| If this is set to TRUE when you load the migrations class and have +| $config['migration_enabled'] set to TRUE the system will auto migrate +| to your latest migration (whatever $config['migration_version'] is +| set to). This way you do not have to call migrations anywhere else +| in your code to have the latest migration. +| +*/ +$config['migration_auto_latest'] = FALSE; + + /* |-------------------------------------------------------------------------- | Migrations version diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 682d90752..28b1dd69f 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -33,6 +33,7 @@ class CI_Migration { protected $_migration_path = NULL; protected $_migration_version = 0; protected $_migration_table = 'migrations'; + protected $_migration_auto_latest = FALSE; protected $_error_string = ''; @@ -86,6 +87,15 @@ class CI_Migration { $this->db->insert($this->_migration_table, array('version' => 0)); } + + // Do we auto migrate to the latest migration? + if ( $this->_migration_auto_latest == TRUE ) + { + if ( ! $this->latest() ) + { + show_error($this->error_string()); + } + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 63b61e3bedd2a5729bef15b79ea64fa0a9d54893 Mon Sep 17 00:00:00 2001 From: "Cloudmanic Labs, LLC" Date: Mon, 19 Sep 2011 09:35:05 -0700 Subject: Fixed style guide suggestion from philsturgeon on code review --- system/libraries/Migration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 28b1dd69f..840cefe08 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -71,7 +71,7 @@ class CI_Migration { $this->load->dbforge(); // Make sure the migration table name was set. - if ( (! isset($this->_migration_table)) OR (empty($this->_migration_table))) + if (empty($this->_migration_table)) { show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); } -- cgit v1.2.3-24-g4f1b From 44e6182d2e50aef657511660b96486a2c8f8d78d Mon Sep 17 00:00:00 2001 From: Aaron Kuzemchak Date: Tue, 20 Sep 2011 21:29:30 -0400 Subject: Updating changelog --- user_guide/changelog.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index fb6e4493a..ad4f6c703 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -97,6 +97,7 @@ Change Log
  • Added max_filename_increment config setting for Upload library.
  • CI_Loader::_ci_autoloader() is now a protected method.
  • Added is_unique to the Form Validation library.
  • +
  • Added $config['use_page_numbers'] to the Pagination library, which enables real page numbers in the URI.
  • Core -- cgit v1.2.3-24-g4f1b From ef3e2402b22a7687730520971c27bec466b5167d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Sep 2011 14:39:29 +0300 Subject: Fix issue #182 in system/database/drivers/oci8_result.php by caching the num_rows property after statement execution --- system/database/drivers/oci8/oci8_result.php | 17 ++++++++++------- user_guide/changelog.html | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 88531b436..2713f6f12 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -42,15 +42,18 @@ class CI_DB_oci8_result extends CI_DB_result { */ function num_rows() { - $rowcount = count($this->result_array()); - @ociexecute($this->stmt_id); - - if ($this->curs_id) + if ($this->num_rows === 0 && count($this->result_array()) > 0) { - @ociexecute($this->curs_id); + $this->num_rows = count($this->result_array()); + @ociexecute($this->stmt_id); + + if ($this->curs_id) + { + @ociexecute($this->curs_id); + } } - return $rowcount; + return $this->num_rows; } // -------------------------------------------------------------------- @@ -246,4 +249,4 @@ class CI_DB_oci8_result extends CI_DB_result { /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_result.php */ diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 8a4a70642..b205d5e3b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -129,6 +129,7 @@ Change Log
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
  • Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.
  • +
  • Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 48b2301d7e8cc2a4cb164a4bc24c59b656f4f49b Mon Sep 17 00:00:00 2001 From: garthkerr Date: Wed, 21 Sep 2011 20:52:50 -0300 Subject: Added a condition so that the previous link respects use_page_numbers configuration. --- system/libraries/Pagination.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index f190d55fd..eff754a1b 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -229,7 +229,7 @@ class CI_Pagination { { $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; - if ($i == 0 && $this->first_url != '') + if (($i == 0 OR ($this->use_page_numbers && $i == 1)) AND $this->first_url != '') { $output .= $this->prev_tag_open.'anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.''.$this->prev_tag_close; } -- cgit v1.2.3-24-g4f1b From 19277f05c20a3de4beaebcac722659a0ed30a374 Mon Sep 17 00:00:00 2001 From: Adrian Macneil Date: Thu, 22 Sep 2011 11:17:58 -0700 Subject: Documented third $after_field parameter of dbforge->add_column() --- user_guide/database/forge.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index 6b8709892..528d1a24c 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -201,6 +201,10 @@ already be running, since the forge class relies on it.

    $this->dbforge->add_column('table_name', $fields);

    // gives ALTER TABLE table_name ADD preferences TEXT

    +

    An optional third parameter can be used to specify which existing column to add the new column after.

    +

    +$this->dbforge->add_column('table_name', $fields, 'after_field'); +

    $this->dbforge->drop_column()

    Used to remove a column from a table.

    $this->dbforge->drop_column('table_name', 'column_to_drop');

    -- cgit v1.2.3-24-g4f1b From 99c6dd49e61c463499d1e50945ac29a3f383ec48 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 23 Sep 2011 03:07:01 +0300 Subject: Add ->db->insert_batch() support to the OCI8 (Oracle) driver --- system/database/drivers/oci8/oci8_driver.php | 28 +++++++++++++++++++++++++++- user_guide/changelog.html | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index d4c27fa43..33991ab53 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -642,6 +642,32 @@ 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 * @@ -776,4 +802,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 */ diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 8a4a70642..950a0d482 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -91,6 +91,7 @@ Change Log
  • Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver.
  • +
  • Added $this->db->insert_batch() support to the OCI8 (Oracle) driver.
  • Libraries -- cgit v1.2.3-24-g4f1b From b83c4088829207af39e862d6252eff393bc71642 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 23 Sep 2011 03:32:45 +0300 Subject: Add brackets to the for() loop --- system/database/drivers/oci8/oci8_driver.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 33991ab53..1cf063ec1 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -659,7 +659,9 @@ class CI_DB_oci8_driver extends CI_DB { $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'; -- cgit v1.2.3-24-g4f1b From e378a39304723d77f1a3a378706d2a20b83f8e28 Mon Sep 17 00:00:00 2001 From: Rommel Castro A Date: Thu, 22 Sep 2011 18:52:25 -0600 Subject: fixed issue #192 --- system/core/Security.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/core/Security.php b/system/core/Security.php index e99418bdd..6c4c59057 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -169,6 +169,7 @@ class CI_Security { // Nothing should last forever unset($_COOKIE[$this->_csrf_cookie_name]); + $this->_csrf_hash = ''; $this->_csrf_set_hash(); $this->csrf_set_cookie(); -- cgit v1.2.3-24-g4f1b