From 6e821cecf8ace0e7d721dd946568664c840434aa Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 15 Feb 2012 18:40:39 -0500 Subject: Implemented insert_id() method --- user_guide_src/source/database/helpers.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'user_guide_src/source/database') diff --git a/user_guide_src/source/database/helpers.rst b/user_guide_src/source/database/helpers.rst index 7ea19e9f6..e8a5ac801 100644 --- a/user_guide_src/source/database/helpers.rst +++ b/user_guide_src/source/database/helpers.rst @@ -7,9 +7,9 @@ $this->db->insert_id() The insert ID number when performing database inserts. -.. note:: If using the PDO driver with PostgreSQL, this function requires - a $name parameter, which specifies the appropriate sequence to check - for the insert id. +.. note:: If using the PDO driver with PostgreSQL, or using the Interbase + driver, this function requires a $name parameter, which specifies the + appropriate sequence to check for the insert id. $this->db->affected_rows() =========================== -- cgit v1.2.3-24-g4f1b From ab189e162f20f1a7daae8bfd2b921e694c3f9df3 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 22 Feb 2012 10:34:23 -0500 Subject: Close services after using them, added dbutil->backup() method --- user_guide_src/source/database/utilities.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'user_guide_src/source/database') diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index b0920109f..3805ffb87 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -161,7 +161,11 @@ $this->dbutil->backup() Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format. -.. note:: This features is only available for MySQL databases. +.. note:: This features is only available for MySQL and Interbase/Firebird databases. + +.. note:: For Interbase/Firebird databases, the backup file name is the only parameter. + + Eg. $this->dbutil->backup('db_backup_filename'); .. note:: Due to the limited execution time and memory available to PHP, backing up very large databases may not be possible. If your database is -- cgit v1.2.3-24-g4f1b From 4be5de1d11eefd9f0b7cf0589a2942f067cefe35 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 2 Mar 2012 15:45:41 +0200 Subject: Replaced DB methods _error_message() and _error_number() with error() (issue #1097) --- user_guide_src/source/database/queries.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'user_guide_src/source/database') diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index 971d5d61d..15a73614a 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -112,3 +112,20 @@ The secondary benefit of using binds is that the values are automatically escaped, producing safer queries. You don't have to remember to manually escape data; the engine does it automatically for you. + +*************** +Handling Errors +*************** + +$this->db->error(); +=================== + +If you need to get the last error that has occured, the error() method +will return an array containing its code and message. Here's a quick +example:: + + if ( ! $this->db->simple_query('SELECT `example_field` FROM `example_table`')) + { + $error = $this->db->error(); // Has keys 'code' and 'message' + } + -- cgit v1.2.3-24-g4f1b