diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-06-27 14:02:13 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-06-27 14:02:13 +0200 |
commit | 13077951b63cf9858dc14ec9cab7f2b53ec88a3e (patch) | |
tree | e1fc50ddb8c0a4103c945f15d674d85c6655231b /user_guide_src/source/database/queries.rst | |
parent | 9128231452f3ccea857a848b61bd0e6e9e319737 (diff) | |
parent | b66664b5decd68de50ae6c239c8d995d6c088d94 (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into email
Diffstat (limited to 'user_guide_src/source/database/queries.rst')
-rw-r--r-- | user_guide_src/source/database/queries.rst | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index d23efecb3..11dd78392 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -21,11 +21,31 @@ this:: $this->db->simple_query(); =========================== -This is a simplified version of the $this->db->query() function. It ONLY -returns TRUE/FALSE on success or failure. It DOES NOT return a database -result set, nor does it set the query timer, or compile bind data, or -store your query for debugging. It simply lets you submit a query. Most -users will rarely use this function. +This is a simplified version of the $this->db->query() method. It DOES +NOT return a database result set, nor does it set the query timer, or +compile bind data, or store your query for debugging. It simply lets you +submit a query. Most users will rarely use this function. + +It returns whatever the database drivers' "execute" function returns. +That typically is TRUE/FALSE on success or failure for write type queries +such as INSERT, DELETE or UPDATE statements (which is what it really +should be used for) and a resource/object on success for queries with +fetchable results. + +:: + + if ($this->db->simple_query('YOUR QUERY')) + { + echo "Success!"; + } + else + { + echo "Query failed!"; + } + +.. note:: PostgreSQL's pg_exec() function always returns a resource on + success, even for write type queries. So take that in mind if + you're looking for a boolean value. *************************************** Working with Database prefixes manually |