From a287a34c215903d3452023d74149eb5880125715 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 5 Nov 2012 23:19:59 +0200 Subject: Refactored DB Forge - PDO subdrivers are isolated from each other now. - Added compatibility for pretty much all of the features, for every DB platform. - Unified the way that stuff works in general. - Fixes issue #1005. --- user_guide_src/source/changelog.rst | 2 ++ user_guide_src/source/database/forge.rst | 14 +++------- user_guide_src/source/installation/upgrade_300.rst | 30 +++++++++++++++++++--- 3 files changed, 32 insertions(+), 14 deletions(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index cbc6295c8..717d7f6ba 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -154,6 +154,8 @@ Release Date: Not Released - Added MySQL client compression support. - Added encrypted connections support (for *mysql*, *sqlsrv* and PDO with *sqlsrv*). - Removed :doc:`Loader Class ` from Database error tracing to better find the likely culprit. + - Added an optional second parameter to ``drop_table()`` in :doc:`Database Forge ` that allows adding the IF EXISTS condition. + - Removed the optional AFTER clause from :doc:`Database Forge ` method ``add_column()``. - Libraries diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index bf17e2918..1d6b847b4 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -193,13 +193,15 @@ into the definition Dropping a table ================ -Executes a DROP TABLE sql +Execute a DROP TABLE statement and optionally add an IF EXISTS clause. :: + // Produces: DROP TABLE table_name $this->dbforge->drop_table('table_name'); - // gives DROP TABLE IF EXISTS table_name + // Produces: DROP TABLE IF EXISTS table_name + $this->dbforge->drop_table('table_name'); Renaming a table ================ @@ -231,14 +233,6 @@ number of additional fields. $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() ============================== diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index fd5eea478..4e0b952d5 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -93,9 +93,31 @@ Step 8: Check the calls to Array Helper's element() and elements() functions The default return value of these functions, when the required elements don't exist, has been changed from FALSE to NULL. -********************************************************** -Step 9: Change usage of Email library with multiple emails -********************************************************** +************************************************************ +Step 9: Update usage of Database Forge's drop_table() method +************************************************************ + +Up until now, ``drop_table()`` added an IF EXISTS clause by default or it didn't work +at all with some drivers. In CodeIgniter 3.0, the IF EXISTS condition is no longer added +by deafault and has an optional second parameter that allows that instead and is set to +FALSE by default. + +If your application relies on IF EXISTS, you'll have to change its usage. + +:: + + // Now produces just DROP TABLE `table_name` + $this->dbforge->drop_table('table_name'); + + // Produces DROP TABLE IF EXISTS `table_name` + $this->dbforge->drop_table('table_name', TRUE); + +.. note:: The given example users MySQL-specific syntax, but it should work across + all drivers with the exception of ODBC. + +*********************************************************** +Step 10: Change usage of Email library with multiple emails +*********************************************************** The :doc:`Email library <../libraries/email>` will automatically clear the set parameters after successfully sending emails. To override this behaviour, @@ -110,7 +132,7 @@ pass FALSE as the first parameter in the ``send()`` method: **************************************************************** -Step 10: Remove usage of (previously) deprecated functionalities +Step 11: Remove usage of (previously) deprecated functionalities **************************************************************** In addition to the ``$autoload['core']`` configuration setting, there's a number of other functionalities -- cgit v1.2.3-24-g4f1b