]> git.mjollnir.org Git - moodle.git/commitdiff
Set Assoc mode always after DB connection. Discovered by MDL-7443
authorstronk7 <stronk7>
Mon, 13 Nov 2006 22:59:58 +0000 (22:59 +0000)
committerstronk7 <stronk7>
Mon, 13 Nov 2006 22:59:58 +0000 (22:59 +0000)
Merged from MOODLE_17_STABLE

auth/db/lib.php

index f8e78f0a6afec76e6b33cf004d4e645308435cf2..e0db9bc677da82cec6f4d8ea5d7d19c70cbe9ff7 100644 (file)
@@ -22,7 +22,8 @@ function auth_user_login ($username, $password) {
 
     // Connect to the external database
     $authdb = &ADONewConnection($CFG->auth_dbtype); 
-    $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); 
+    $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
+    $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
 
     if ($CFG->auth_dbpasstype === 'internal') { 
         // lookup username externally, but resolve
@@ -92,6 +93,7 @@ function auth_get_userinfo($username){
     ADOLoadCode($CFG->auth_dbtype);          
     $authdb = &ADONewConnection();         
     $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); 
+    $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
 
     $fields = array("firstname", "lastname", "email", "phone1", "phone2", 
                     "department", "address", "city", "country", "description", 
@@ -299,6 +301,7 @@ function auth_user_exists ($username) {
     global $CFG;
     $authdb = &ADONewConnection($CFG->auth_dbtype); 
     $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); 
+    $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
 
     $rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable 
                                  WHERE $CFG->auth_dbfielduser = '$username' ");
@@ -331,6 +334,7 @@ function auth_get_userlist() {
     // Connect to the external database
     $authdb = &ADONewConnection($CFG->auth_dbtype); 
     $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); 
+    $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection
 
     // fetch userlist
     $rs = $authdb->Execute("SELECT $CFG->auth_dbfielduser AS username
@@ -456,4 +460,4 @@ function auth_validate_form(&$form, &$err) {
     return true;
 }
 
-?>
\ No newline at end of file
+?>