/** * @AjaxCallable=TRUE * @AjaxMethod=POST * @AjaxAsync=TRUE */ function run_query() { $caseId = $this->session->get('caseId'); $text = filter_input(INPUT_POST, 'text'); QueryModel::add($caseId, $text); $res = QueryModel::run($caseId); return $res; // // Retrieve script path // $path = $this->config->get_item('main', 'decimill_path'); // // $out = NULL; // $res = NULL; // // // Execute query // exec('java -jar ' . $path . 'decimill-client.jar -a runQuery -c ' . $caseId, $out, $res); // // if ($res === 0) { // return [ // 'body' => json_decode($out[0])->body, // 'isError' => false, // 'errCode' => 0 // ]; // } else { // return [ // 'body' => json_decode($out[0])->body, // 'isError' => true, // 'errCode' => $res // ]; // } }