diff options
Diffstat (limited to 'user_guide_src/source/database')
-rw-r--r-- | user_guide_src/source/database/configuration.rst | 19 | ||||
-rw-r--r-- | user_guide_src/source/database/db_driver_reference.rst | 15 | ||||
-rw-r--r-- | user_guide_src/source/database/forge.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/database/query_builder.rst | 98 |
4 files changed, 100 insertions, 35 deletions
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index a9bf7dcb6..a783c2ad6 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -132,23 +132,6 @@ variable located in the config file:: default we've used the word "default" for the primary connection, but it too can be renamed to something more relevant to your project. -Query Builder -------------- - -The :doc:`Query Builder Class <query_builder>` is globally enabled or -disabled by setting the $query_builder variable in the database -configuration file to TRUE/FALSE (boolean). The default setting is TRUE. -If you are not using the -query builder class, setting it to FALSE will utilize fewer resources -when the database classes are initialized. - -:: - - $query_builder = TRUE; - -.. note:: that some CodeIgniter classes such as Sessions require Query - Builder to be enabled to access certain functionality. - Explanation of Values: ---------------------- @@ -156,7 +139,7 @@ Explanation of Values: Name Config Description ====================== =========================================================================================================== **dsn** The DSN connect string (an all-in-one configuration sequence). -**hostname** The hostname of your database server. Often this is 'localhost'. +**hostname** The hostname of your database server. Often this is 'localhost'. **username** The username used to connect to the database. **password** The password used to connect to the database. **database** The name of the database you want to connect to. diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst index da33662b0..8a4f56784 100644 --- a/user_guide_src/source/database/db_driver_reference.rst +++ b/user_guide_src/source/database/db_driver_reference.rst @@ -17,8 +17,8 @@ This article is intended to be a reference for them. .. php:method:: initialize() - :returns: TRUE on success, FALSE on failure - :rtype: bool + :rtype: void + :throws: RuntimeException In case of failure Initialize database settings, establish a connection to the database. @@ -61,14 +61,6 @@ This article is intended to be a reference for them. Select / switch the current database. - .. php:method:: db_set_charset($charset) - - :param string $charset: Character set name - :returns: TRUE on success, FALSE on failure - :rtype: bool - - Set client character set. - .. php:method:: platform() :returns: Platform name @@ -320,9 +312,10 @@ This article is intended to be a reference for them. Gets a list containing field data about a table. - .. php:method:: escape_identifiers($item) + .. php:method:: escape_identifiers($item, $split = TRUE) :param mixed $item: The item or array of items to escape + :param bool $split: Whether to split identifiers when a dot is encountered :returns: The input item(s), escaped :rtype: mixed diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index c6cacb1b0..1562a1a2d 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -322,11 +322,10 @@ Class Reference .. php:class:: CI_DB_forge - .. php:method:: add_column($table[, $field = array()[, $_after = NULL]]) + .. php:method:: add_column($table[, $field = array()]) :param string $table: Table name to add the column to :param array $field: Column definition(s) - :param string $_after: Column for AFTER clause (deprecated) :returns: TRUE on success, FALSE on failure :rtype: bool diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 83721c8b5..a085de293 100644 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -453,6 +453,52 @@ setting it to FALSE. Identical to having(), only separates multiple clauses with "OR". +**$this->db->having_in()** + +Generates a HAVING field IN ('item', 'item') SQL query joined with AND if +appropriate + +:: + + $names = array('Frank', 'Todd', 'James'); + $this->db->having_in('username', $names); + // Produces: HAVING username IN ('Frank', 'Todd', 'James') + + +**$this->db->or_having_in()** + +Generates a HAVING field IN ('item', 'item') SQL query joined with OR if +appropriate + +:: + + $names = array('Frank', 'Todd', 'James'); + $this->db->or_having_in('username', $names); + // Produces: OR username IN ('Frank', 'Todd', 'James') + +**$this->db->having_not_in()** + +Generates a HAVING field NOT IN ('item', 'item') SQL query joined with +AND if appropriate + +:: + + $names = array('Frank', 'Todd', 'James'); + $this->db->having_not_in('username', $names); + // Produces: HAVING username NOT IN ('Frank', 'Todd', 'James') + + +**$this->db->or_having_not_in()** + +Generates a HAVING field NOT IN ('item', 'item') SQL query joined with OR +if appropriate + +:: + + $names = array('Frank', 'Todd', 'James'); + $this->db->or_having_not_in('username', $names); + // Produces: OR username NOT IN ('Frank', 'Todd', 'James') + **************** Ordering results **************** @@ -1235,7 +1281,7 @@ Class Reference Generates the WHERE portion of the query. Separates multiple calls with 'OR'. - .. php:method:: or_where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: or_where_in([$key[, array $values[, $escape = NULL]]]) :param string $key: The field to search :param array $values: The values searched on @@ -1246,7 +1292,7 @@ Class Reference Generates a WHERE field IN('item', 'item') SQL query, joined with 'OR' if appropriate. - .. php:method:: or_where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: or_where_not_in([$key[, array $values[, $escape = NULL]]]) :param string $key: The field to search :param array $values: The values searched on @@ -1257,7 +1303,7 @@ Class Reference Generates a WHERE field NOT IN('item', 'item') SQL query, joined with 'OR' if appropriate. - .. php:method:: where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: where_in([$key[, array $values[, $escape = NULL]]]) :param string $key: Name of field to examine :param array $values: Array of target values @@ -1268,7 +1314,7 @@ Class Reference Generates a WHERE field IN('item', 'item') SQL query, joined with 'AND' if appropriate. - .. php:method:: where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: where_not_in([$key[, array $values[, $escape = NULL]]]) :param string $key: Name of field to examine :param array $values: Array of target values @@ -1378,6 +1424,50 @@ Class Reference Adds a HAVING clause to a query, separating multiple calls with OR. + .. php:method:: or_having_in([$key[, array $values[, $escape = NULL]]]) + + :param string $key: The field to search + :param array $values: The values searched on + :param bool $escape: Whether to escape values and identifiers + :returns: DB_query_builder instance + :rtype: object + + Generates a HAVING field IN('item', 'item') SQL query, + joined with 'OR' if appropriate. + + .. php:method:: or_having_not_in([$key[, array $values[, $escape = NULL]]]) + + :param string $key: The field to search + :param array $values: The values searched on + :param bool $escape: Whether to escape values and identifiers + :returns: DB_query_builder instance + :rtype: object + + Generates a HAVING field NOT IN('item', 'item') SQL query, + joined with 'OR' if appropriate. + + .. php:method:: having_in([$key[, array $values[, $escape = NULL]]]) + + :param string $key: Name of field to examine + :param array $values: Array of target values + :param bool $escape: Whether to escape values and identifiers + :returns: DB_query_builder instance + :rtype: object + + Generates a HAVING field IN('item', 'item') SQL query, + joined with 'AND' if appropriate. + + .. php:method:: having_not_in([$key[, array $values[, $escape = NULL]]]) + + :param string $key: Name of field to examine + :param array $values: Array of target values + :param bool $escape: Whether to escape values and identifiers + :returns: DB_query_builder instance + :rtype: object + + Generates a HAVING field NOT IN('item', 'item') SQL query, + joined with 'AND' if appropriate. + .. php:method:: group_by($by[, $escape = NULL]) :param mixed $by: Field(s) to group by; string or array |