Oracle Authentication, Resultset is Null

Oracle Authentication, Resultset is Null

by Ângelo Rigo -
Number of replies: 3
Hi

In this if part of the get_userinfo function from auth/db/auth.php file, i do get the results in this line:
$fields_obj = rs_fetch_record($rs); boca aberta

and after the values are null olho roxo in this line:
$result[$localname] = $textlib->convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');

I am using linux, php5.2 and Oracle as external database how can i bring the results ?

In the get_userlist function i do solve this problem, changing this line :
array_push($result, $rec->username);
to :
array_push($result, $rec->USERNAME);

How can i have the same effect to the others atributes i am tring to bring from oracle ?

if ($rs = $authdb->Execute($sql)) {
if ( $rs->RecordCount() == 1 ) {
$fields_obj = rs_fetch_record($rs); //Ok i have the results !!
var_dump($fields_obj);
foreach ($selectfields as $localname=>$externalname) {
$result[$localname] = $textlib->convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');//They are all null !!
}
}
rs_close($rs);
}

Thank´s in advance
Average of ratings: -
In reply to Ângelo Rigo

Re: Oracle Authentication, Resultset is Null

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ângelo,

as commented in MDL-15175, something like:
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
after the line:
$fields_obj = rs_fetch_record($rs);
should do the trick and convert all the fieldnames to lowercase.

That way all the external DBs will work, while your suggested change to uppercase them, won't be cross-db, because it works in Oracle but not in the rest.

I haven't tested it, so it would be great if you can confirm that it works... TIA! cool

Ciao smile
Average of ratings: Useful (1)
In reply to Eloy Lafuente (stronk7)

Re: Oracle Authentication, Resultset is Null

by Ângelo Rigo -
Hi Eloy

That´s so great boca aberta, now the sync is working very well. I have all the records from oracle to mysql.

Hope more people with the same problem can benefit from this patch.

I will also test with the 1.9 version.

Cheers
In reply to Eloy Lafuente (stronk7)

Re: Oracle Authentication, Resultset is Null

by Ângelo Rigo -
Hi Eloy

Just the assignee to the tracker can change the status as Resolved ?

For me the problem is solved !

Best regards