Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-9212

auth-sync_users does not work against external MSSQL db

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.1
    • Component/s: Authentication
    • Labels:
      None
    • Environment:
      Windows 2003, PHP, Apache, MySQL
    • Database:
      Microsoft SQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      I´m trying sync users with a MSSQL, but only one result is fetched and updated from more than 300.
      Searching throught the code I found that the msssql query result set was perfect, but is truncated or destroyed on this suspicious snippet from moodle/lib/adodb/adodb.inc.php:

      line 906:
      /************************
      // OK, query executed
      *************************/

      if ($this->_queryID === false) { // error handling if query fails
      if ($this->debug == 99) adodb_backtrace(true,5);
      $fn = $this->raiseErrorFn;
      if ($fn)

      { $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr,$this); }


      $false = false;
      return $false;
      }

      if ($this->_queryID === true)

      { // return simplified recordset for inserts/updates/deletes with lower overhead $rs =& new ADORecordSet_empty(); return $rs; }

      // return real recordset from select statement
      $rsclass = $this->rsPrefix.$this->databaseType;
      $rs = new $rsclass($this->_queryID,$this->fetchMode);
      print($rsclass);//seiti
      $rs->connection = &$this; // Pablo suggestion
      $rs->Init();
      if (is_array($sql)) $rs->sql = $sql[0];
      else $rs->sql = $sql;
      if ($rs->_numOfRows <= 0) {
      global $ADODB_COUNTRECS;
      if ($ADODB_COUNTRECS) {
      if (!$rs->EOF)

      { $rs = &$this->_rs2rs($rs,-1,-1,!is_array($sql)); $rs->_queryID = $this->_queryID; }

      else
      $rs->_numOfRows = 0;
      }
      }

      Before that code the result set contains all the users to be inserted on moodle db. After it have only one.

      (Forgive me about my poor english...)

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            seiti Seiti Yamashiro
            Tester:
            Nobody
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jun/07