summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/helpers.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-11-25 10:17:30 +0100
committerAndrey Andreev <narf@devilix.net>2014-11-25 10:17:30 +0100
commit809a1b516d4760fe631f8d3ffa767b9f9310dacc (patch)
tree473d9c9ff073b351de87fa49b3369200289455ab /user_guide_src/source/database/helpers.rst
parent8371eb1f77b0a325cb89ad437d572ef1b94f5cf4 (diff)
parent8b85526c6a9758ef92340ba0df6a32249a578b39 (diff)
Merge pull request #3369 from jim-parry/userguide/database
Userguide/database - part 1
Diffstat (limited to 'user_guide_src/source/database/helpers.rst')
-rw-r--r--user_guide_src/source/database/helpers.rst61
1 files changed, 31 insertions, 30 deletions
diff --git a/user_guide_src/source/database/helpers.rst b/user_guide_src/source/database/helpers.rst
index 77bf1b5d2..2d997a9e0 100644
--- a/user_guide_src/source/database/helpers.rst
+++ b/user_guide_src/source/database/helpers.rst
@@ -1,9 +1,11 @@
-######################
-Query Helper Functions
-######################
+####################
+Query Helper Methods
+####################
-$this->db->insert_id()
-======================
+Information From Executing a Query
+==================================
+
+**$this->db->insert_id()**
The insert ID number when performing database inserts.
@@ -11,8 +13,7 @@ The insert ID number when performing database inserts.
driver, this function requires a $name parameter, which specifies the
appropriate sequence to check for the insert id.
-$this->db->affected_rows()
-==========================
+**$this->db->affected_rows()**
Displays the number of affected rows, when doing "write" type queries
(insert, update, etc.).
@@ -22,8 +23,23 @@ Displays the number of affected rows, when doing "write" type queries
affected rows. By default this hack is enabled but it can be turned off
in the database driver file.
-$this->db->count_all()
-======================
+**$this->db->last_query()**
+
+Returns the last query that was run (the query string, not the result).
+Example::
+
+ $str = $this->db->last_query();
+
+ // Produces: SELECT * FROM sometable....
+
+
+.. note:: Disabling the **save_queries** setting in your database
+ configuration will render this function useless.
+
+Information About Your Database
+===============================
+
+**$this->db->count_all()**
Permits you to determine the number of rows in a particular table.
Submit the table name in the first parameter. Example::
@@ -32,38 +48,24 @@ Submit the table name in the first parameter. Example::
// Produces an integer, like 25
-$this->db->platform()
-=====================
+**$this->db->platform()**
Outputs the database platform you are running (MySQL, MS SQL, Postgres,
etc...)::
echo $this->db->platform();
-$this->db->version()
-====================
+**$this->db->version()**
Outputs the database version you are running::
echo $this->db->version();
-$this->db->last_query()
-=======================
-
-Returns the last query that was run (the query string, not the result).
-Example::
-
- $str = $this->db->last_query();
-
- // Produces: SELECT * FROM sometable....
-
-
-.. note:: Disabling the **save_queries** setting in your database
- configuration will render this function useless.
-
-$this->db->insert_string()
+Making Your Queries Easier
==========================
+**$this->db->insert_string()**
+
This function simplifies the process of writing database inserts. It
returns a correctly formatted SQL insert string. Example::
@@ -78,8 +80,7 @@ array with the data to be inserted. The above example produces::
.. note:: Values are automatically escaped, producing safer queries.
-$this->db->update_string()
-==========================
+**$this->db->update_string()**
This function simplifies the process of writing database updates. It
returns a correctly formatted SQL update string. Example::