function qformat_coursetestmanager::query_linux in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format/coursetestmanager/format.php \qformat_coursetestmanager::query_linux()
2 calls to qformat_coursetestmanager::query_linux()
- qformat_coursetestmanager::getquestioncategories in includes/
moodle/ question/ format/ coursetestmanager/ format.php - qformat_coursetestmanager::getquestions in includes/
moodle/ question/ format/ coursetestmanager/ format.php
File
- includes/
moodle/ question/ format/ coursetestmanager/ format.php, line 365
Class
Code
function query_linux($sql, $mdbpath, $mdapath, $hostname) {
global $result;
include_once "odbcsocketserver.class.php";
// set up socket server object to connect to remote host
$oTest = new ODBCSocketServer();
//Set the Hostname, port, and connection string
$oTest->sHostName = $hostname;
$oTest->nPort = 9628;
// $oTest->sConnectionString="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=C:\CTM\System.mda;DBQ=C:\CTM\of2K3\ctm.mdb;UID=Assess;PWD=VBMango;";
$oTest->sConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);SystemDB=" . $mdapath . ";DBQ=" . $mdbpath . ";UID=Assess;PWD=VBMango;";
// send and receive XML communication
$qResult = $oTest
->ExecSQL($sql);
// set up XML parser to read the results
$xml_parser = xml_parser_create("US-ASCII");
xml_set_element_handler($xml_parser, "quiz_xmlstart", "quiz_xmlend");
xml_set_character_data_handler($xml_parser, "quiz_xmldata");
// parse the XML and get back the result set array
if (!xml_parse($xml_parser, $qResult)) {
$this
->err("XML error: " . xml_error_string(xml_get_error_code($xml_parser)) . " at line " . xml_get_current_line_number($xml_parser), $oTest->sConnectionString);
return false;
}
else {
// echo("Successful XML parse. ");
// prepare the array for use in the pull-down
/* echo "<br />count of rows is ". count ($result);
echo "<pre>\n";
$qResult = HtmlSpecialChars($qResult);
echo $qResult;
echo "\n</pre>";
*/
xml_parser_free($xml_parser);
// $sResult = HtmlSpecialChars($qResult);
//echo("<pre>");
// echo($sResult);
// echo("</pre>");
return $result;
}
}