From a58ecae8e149fe8e1fa9ee3cc9c9ad23a67ab8b6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 15 Dec 2010 10:32:10 +0000 Subject: Name can be omiitted from ->dbforge->modify_column()'s 2nd param if you aren't changing the name. --- user_guide/database/forge.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/database') diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index 28b32d96a..b9e04428c 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -205,7 +205,7 @@ $this->dbforge->add_column('table_name', $fields);

Used to remove a column from a table.

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

$this->dbforge->modify_column()

-

The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to use it you must add a "name" key into the field defining array.

+

The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to change the name you can add a "name" key into the field defining array.

$fields = array(
                        'old_name' => array(
                                                         'name' => 'new_name',
-- cgit v1.2.3-24-g4f1b From f85a4b897b9dfce3de315f307f6fe07606b95131 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 13 Jan 2011 06:52:21 -0500 Subject: Updating references to deprecated functions in the active record documentation --- user_guide/database/active_record.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/database') diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 065db4913..9ae93a9ae 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -736,7 +736,7 @@ $this->db->get('tablename');

//Generates: SELECT `field2` FROM (`tablename`)

-

Note: The following statements can be cached: select, from, join, where, like, groupby, having, orderby, set

+

Note: The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set

 

-- cgit v1.2.3-24-g4f1b From 42aa95bfee77baa6d4fe2728c4a02c61b7a3cac1 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 18:16:21 +0100 Subject: Added documentation for environments --- user_guide/database/configuration.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'user_guide/database') diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html index 893db6221..34d267596 100644 --- a/user_guide/database/configuration.html +++ b/user_guide/database/configuration.html @@ -61,9 +61,7 @@ Configuration

Database Configuration

CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). -The config file is located at:

- -

application/config/database.php

+The config file is located at application/config/database.php. You can also set database connection values for specific environments by placing database.php it the respective environment config folder.

The config settings are stored in a multi-dimensional array with this prototype:

-- cgit v1.2.3-24-g4f1b From 700205ad5cb6c00596ad82d5ed282f516add5481 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 28 Jan 2011 07:44:28 -0600 Subject: updating copyrights to 2011 --- user_guide/database/active_record.html | 2 +- user_guide/database/caching.html | 2 +- user_guide/database/call_function.html | 2 +- user_guide/database/configuration.html | 2 +- user_guide/database/connecting.html | 2 +- user_guide/database/examples.html | 2 +- user_guide/database/fields.html | 2 +- user_guide/database/forge.html | 2 +- user_guide/database/helpers.html | 2 +- user_guide/database/index.html | 2 +- user_guide/database/queries.html | 2 +- user_guide/database/results.html | 2 +- user_guide/database/table_data.html | 2 +- user_guide/database/transactions.html | 2 +- user_guide/database/utilities.html | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) (limited to 'user_guide/database') diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 9ae93a9ae..30c45fdde 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -750,7 +750,7 @@ Previous Topic:  Query Helper Functions User Guide Home   ·   Next Topic:  Transactions

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html index d5ed5885d..ec2e5c40b 100644 --- a/user_guide/database/caching.html +++ b/user_guide/database/caching.html @@ -213,7 +213,7 @@ Previous Topic:  Custom Function CallsUser Guide Home   ·   Next Topic:  Database manipulation with Database Forge

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html index 46dfe89dc..e34369f37 100644 --- a/user_guide/database/call_function.html +++ b/user_guide/database/call_function.html @@ -111,7 +111,7 @@ Previous Topic:  Field MetaData User Guide Home   ·   Next Topic:  Query Caching

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html index 893db6221..8e6fe1f42 100644 --- a/user_guide/database/configuration.html +++ b/user_guide/database/configuration.html @@ -159,7 +159,7 @@ Previous Topic:  Quick Start: Usage ExamplesUser Guide Home   ·   Next Topic:  Connecting to your Database

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html index 3ce405629..1e971986e 100644 --- a/user_guide/database/connecting.html +++ b/user_guide/database/connecting.html @@ -181,7 +181,7 @@ Previous Topic:  Database ConfigurationUser Guide Home   ·   Next Topic:  Queries

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/examples.html b/user_guide/database/examples.html index 41cfba0eb..c0eabd846 100644 --- a/user_guide/database/examples.html +++ b/user_guide/database/examples.html @@ -210,7 +210,7 @@ Previous Topic:  Database Class User Guide Home   ·   Next Topic:  Database Configuration

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index e5cc4777d..b1dbd0012 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -156,7 +156,7 @@ Previous Topic:   Table Data User Guide Home   ·   Next Topic:  Custom Function Calls

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index b9e04428c..d18db5820 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -227,7 +227,7 @@ Previous Topic:  DB Caching Class Top of Page   ·   User Guide Home   ·   Next Topic:  Database Utilities Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html index b7b8a538c..f4ad8dfe6 100644 --- a/user_guide/database/helpers.html +++ b/user_guide/database/helpers.html @@ -144,7 +144,7 @@ Previous Topic:  Query Results User Guide Home   ·   Next Topic:  Active Record Pattern

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/index.html b/user_guide/database/index.html index 381592c26..cc2d2166b 100644 --- a/user_guide/database/index.html +++ b/user_guide/database/index.html @@ -92,7 +92,7 @@ Previous Topic:  Config Class User Guide Home   ·   Next Topic:  Quick Start: Usage Examples

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html index c8a304943..e3d6ab186 100644 --- a/user_guide/database/queries.html +++ b/user_guide/database/queries.html @@ -146,7 +146,7 @@ Previous Topic:  Connecting to your Database User Guide Home   ·   Next Topic:  Query Results

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/results.html b/user_guide/database/results.html index 410dac840..75cb190f9 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -231,7 +231,7 @@ Previous Topic:  Queries User Guide Home   ·   Next Topic:  Query Helper Functions

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html index 8b86ed58e..90ce478da 100644 --- a/user_guide/database/table_data.html +++ b/user_guide/database/table_data.html @@ -106,7 +106,7 @@ Previous Topic:   Transactions User Guide Home   ·   Next Topic:   Field Metadata

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html index c6ecac6fb..448e468d9 100644 --- a/user_guide/database/transactions.html +++ b/user_guide/database/transactions.html @@ -193,7 +193,7 @@ Previous Topic:   Field MetaData   User Guide Home   ·   Next Topic:  Table Metadata

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index 1ce63d3a0..d4296fe2e 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -307,7 +307,7 @@ Previous Topic:  DB Forge Class Top of Page   ·   User Guide Home   ·   Next Topic:   Email Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

-- cgit v1.2.3-24-g4f1b From c7f2bd28a8b26a6ed61f83f1d75fdd78aa37ebfe Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 30 Jan 2011 20:50:08 -0500 Subject: The db utility had the wrong code example for database_exists(). Fixes #26 --- user_guide/database/utilities.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide/database') diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index d4296fe2e..ac3841641 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -102,13 +102,13 @@ foreach($dbs as $db)
} -

$this->db->database_exists();

+

$this->dbutil->database_exists();

Sometimes it's helpful to know whether a particular database exists. Returns a boolean TRUE/FALSE. Usage example:

-if ($this->db->database_exists('database_name'))
+if ($this->dbutil->database_exists('database_name'))
{
   // some code...
} -- cgit v1.2.3-24-g4f1b From 5fd02675ed3d079c2719374b890fac599a2ef991 Mon Sep 17 00:00:00 2001 From: katzgrau Date: Wed, 2 Feb 2011 16:33:05 -0500 Subject: Added a better explanation for the 'autoinit' db option. Side note: should that really be true by default? --- user_guide/database/configuration.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/database') diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html index e9db5fc87..d71cd34db 100644 --- a/user_guide/database/configuration.html +++ b/user_guide/database/configuration.html @@ -134,7 +134,7 @@ for the primary connection, but it too can be renamed to something more relevant
  • char_set - The character set used in communicating with the database.
  • dbcollat - The character collation used in communicating with the database.
  • swap_pre - A default table prefix that should be swapped with dbprefix. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.
  • -
  • autoinit - Whether or not to automatically initialize the database.
  • +
  • autoinit - Whether or not to automatically connect to the database when the library loads. If set to false, the connection will take place prior to executing the first query.
  • stricton - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.
  • port - The database port number. To use this value you have to add a line to the database config array.$db['default']['port'] = 5432; -- cgit v1.2.3-24-g4f1b From 58e8caf2afb3ea054f83999fb0698720a1a58738 Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Sat, 5 Feb 2011 22:19:57 -0500 Subject: Added documentation for changes to DB_result --- user_guide/database/results.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'user_guide/database') diff --git a/user_guide/database/results.html b/user_guide/database/results.html index 75cb190f9..e9a5cb4cf 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -98,6 +98,18 @@ Query Results } +

    You can also pass a string to result() which represents a class to instantiate for each result object (note: this class must be loaded)

    + + + $query = $this->db->query("SELECT * FROM users;");
    +
    + foreach ($query->result('User') as $user)
    + {
    +    echo $row->name; // call attributes
    +    echo $row->reverse_name(); // or methods defined on the 'User' class
    + } +
    +

    result_array()

    This function returns the query result as a pure array, or an empty array when no result is produced. Typically you'll use this in a foreach loop, like this:

    @@ -133,6 +145,15 @@ Query Results $row = $query->row(5); +

    You can also add a second String parameter, which is the name of a class to instantiate the row with:

    + + + $query = $this->db->query("SELECT * FROM users LIMIT 1;");
    +
    + $query->row(0, 'User')
    + echo $row->name; // call attributes
    + echo $row->reverse_name(); // or methods defined on the 'User' class
    +

    row_array()

    @@ -235,4 +256,4 @@ Next Topic:  Query Helper Functions - \ No newline at end of file + -- cgit v1.2.3-24-g4f1b From feba2de9287ed2c5d43e555fc52ce2bdedfed0d9 Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Mon, 14 Feb 2011 13:25:30 -0500 Subject: Whitespace tweaks to put code examples in line with our guidelines --- user_guide/database/utilities.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/database') diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index ac3841641..4a8b6739e 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -96,7 +96,7 @@ already be running, since the utilities class relies on it.

    $dbs = $this->dbutil->list_databases();

    -foreach($dbs as $db)
    +foreach ($dbs as $db)
    {
        echo $db;
    }
    -- cgit v1.2.3-24-g4f1b