diff options
author | Timothy Warren <tim@timshomepage.net> | 2011-09-23 16:28:13 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2011-09-23 16:28:13 +0200 |
commit | 4d292bdb56ba6afc26878d9bcd82892f48d9f1a4 (patch) | |
tree | a894323d2e896adcb7d25d7d1edb806295147384 /user_guide | |
parent | 5fc36d8c9dc0bd5d41ed7dea36f999c6e07e1615 (diff) | |
parent | d26133be24eef68b1bead61e7e808f4424a71a0a (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/changelog.html | 4 | ||||
-rw-r--r-- | user_guide/database/active_record.html | 37 | ||||
-rw-r--r-- | user_guide/database/forge.html | 4 | ||||
-rw-r--r-- | user_guide/installation/upgrading.html | 1 | ||||
-rw-r--r-- | user_guide/libraries/pagination.html | 6 |
5 files changed, 50 insertions, 2 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index f555159ee..d2601360e 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -92,6 +92,7 @@ Change Log <li> Added additional option 'none' for the optional third argument for <kbd>$this->db->like()</kbd> in the <a href="database/active_record.html">Database Driver</a>. </li> + <li>Added <kbd>$this->db->insert_batch()</kbd> support to the OCI8 (Oracle) driver.</li> </ul> </li> <li>Libraries @@ -104,6 +105,7 @@ Change Log <li><samp>CI_Loader::_ci_autoloader()</samp> is now a protected method.</li> <li>Added <kbd>is_unique</kbd> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li> <li>Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the <a href="libraries/form_validation.html">Form Validation</a> library.</li> + <li>Added <kbd>$config['use_page_numbers']</kbd> to the <a href="libraries/pagination.html">Pagination library</a>, which enables real page numbers in the URI.</li> </ul> </li> <li>Core @@ -129,6 +131,8 @@ Change Log <li>Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().</li> <li>Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.</li> <li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li> + <li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li> + <li>Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.</li> </ul> <h2>Version 2.0.3</h2> 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(<br /> )<br /> );<br /> <br /> -$this->db->update_batch('mytable', $data); +$this->db->insert_batch('mytable', $data); <br /><br /> // Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code> @@ -666,6 +666,41 @@ You can optionally pass this information directly into the update function as a <p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p> +<h2>$this->db->update_batch();</h2> +<p>Generates an update string based on the data you supply, and runs the query. You can either pass an +<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p> + +<code> +$data = array(<br/> + array(<br /> + 'title' => 'My title' ,<br /> + 'name' => 'My Name 2' ,<br /> + 'date' => 'My date 2'<br /> + ),<br /> + array(<br /> + 'title' => 'Another title' ,<br /> + 'name' => 'Another Name 2' ,<br /> + 'date' => 'Another date 2'<br /> + )<br/> +);<br /> +<br /> +$this->db->update_batch('mytable', $data, 'title'); +<br /><br /> +// Produces: <br /> +// UPDATE `mytable` SET `name` = CASE<br /> +// WHEN `title` = 'My title' THEN 'My Name 2'<br /> +// WHEN `title` = 'Another title' THEN 'Another Name 2'<br /> +// ELSE `name` END,<br /> +// `date` = CASE <br /> +// WHEN `title` = 'My title' THEN 'My date 2'<br /> +// WHEN `title` = 'Another title' THEN 'Another date 2'<br /> +// ELSE `date` END<br /> +// WHERE `title` IN ('My title','Another title')</code> + +<p>The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.</p> + +<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p> + <a name="delete"> </a> <h1>Deleting Data</h1> 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.</p> $this->dbforge->add_column('table_name', $fields);<br /> <br /> // gives ALTER TABLE table_name ADD preferences TEXT</code></p> +<p>An optional third parameter can be used to specify which existing column to add the new column after.</p> +<p><code> +$this->dbforge->add_column('table_name', $fields, 'after_field'); +</code></p> <h2>$this->dbforge->drop_column()</h2> <p>Used to remove a column from a table. </p> <p><code>$this->dbforge->drop_column('table_name', 'column_to_drop');</code></p> 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 <p>Please read the upgrade notes corresponding to the version you are upgrading from.</p> <ul> + <li><a href="upgrade_210.html">Upgrading from 2.0.3 to 2.1.0</a></li> <li><a href="upgrade_203.html">Upgrading from 2.0.2 to 2.0.3</a></li> <li><a href="upgrade_202.html">Upgrading from 2.0.1 to 2.0.2</a></li> <li><a href="upgrade_201.html">Upgrading from 2.0 to 2.0.1</a></li> 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.</p> <p>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.</p> -<h4>$config['page_query_string'] = TRUE</h4> + +<h4>$config['use_page_numbers'] = TRUE;</h4> +<p>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.</p> + +<h4>$config['page_query_string'] = TRUE;</h4> <p>By default, the pagination library assume you are using <a href="../general/urls.html">URI Segments</a>, and constructs your links something like</p> <p><code>http://example.com/index.php/test/page/20</code></p> <p>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.</p> |