summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorJames L Parry <jim_parry@bcit.ca>2014-11-25 02:10:31 +0100
committerJames L Parry <jim_parry@bcit.ca>2014-11-25 02:10:31 +0100
commitb4f8caac35976b8938a996f6f2ed9a65c1c158a1 (patch)
treea5059916dea1424fe1ebba1e773de67ff6ff2172 /user_guide_src/source
parente4a9f644b6cf173cec7ea01bfecab21760777858 (diff)
Database guide update
Updated the helpers writeup, making the format more consistene with the rest of the database writeups. Signed-off-by:James L Parry <jim_parry@bcit.ca>
Diffstat (limited to 'user_guide_src/source')
-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::