Commit d768f7ef6cfe9217ced8d0283f507c9646e1ba65

Authored by Neil Blakey-Milner
1 parent 92b48ea3

autoInsert returns the ID of the inserted row, not success. Use

PEAR::isError to determine failure.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3089 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 5 additions and 6 deletions
lib/session/Session.inc
@@ -32,7 +32,7 @@ class Session { @@ -32,7 +32,7 @@ class Session {
32 * @param int the id of the user to create a session for 32 * @param int the id of the user to create a session for
33 * @return string the generated sessionID 33 * @return string the generated sessionID
34 */ 34 */
35 - function create($iUserID) { 35 + function create($iUserID) {
36 global $default; 36 global $default;
37 37
38 session_start(); 38 session_start();
@@ -58,12 +58,11 @@ class Session { @@ -58,12 +58,11 @@ class Session {
58 ); 58 );
59 59
60 $result = DBUtil::autoInsert($default->sessions_table, $aParams); 60 $result = DBUtil::autoInsert($default->sessions_table, $aParams);
61 - if($result != DB_OK) {  
62 - die("$lang_err_sess_write"); 61 + if (PEAR::isError($result)) {
  62 + die("Error creating session: " . $result->toString());
63 } 63 }
64 -  
65 - return $sessionID;  
66 - } 64 + return $sessionID;
  65 + }
67 66
68 /** 67 /**
69 * Destroys the current session. 68 * Destroys the current session.