exit; } fprintf($ofp, "q delete {$tbl} {$tempflds} \n"); } if ($is_grpby) { fprintf($ofp, "q delete {$grpbytbl} cnt:xidx \n"); } fclose($ofp); return true; } $is_cli = true; if ($is_cli) { if ($argc != 3) { echo "Usage is " . $argv[0] . " <in.json> <out.q> \n"; exit; } $infile = $argv[1]; $str = file_get_contents($infile); if (!is_file($infile)) { echo "file not found [{$infile}]\n"; exit; } $opfile = $argv[2]; $instr = file_get_contents($infile); $rslt = json_to_q_O3($instr, $opfile); if ($rslt === true) { echo "Created {$opfile} from {$infile} \n"; } else { echo "Error in infile \n"; } }
// Get the parameters $optflag = get_param("OPTFLAG"); $query = get_param("QUERY"); if ($query == "") { $is_err = true; $err_msg = "Query not specified\n"; } if ($is_err === true) { header("HTTP/1.1 500 Internal Server Error"); echo "<H1> Problem with Inputs </H1> \n"; echo "<H2> Error = [{$err_msg}] </H2> \n"; exit; } $qfile = tempnam($ramfsdir, "_tempf_"); if ($optflag == "O3") { $rslt = json_to_q_O3($query, $qfile); } else { if ($optflag == "GPU") { /* $rslt = json_to_q_GPU($query, $qfile); $rslt = false; */ } else { $rslt = json_to_q($query, $qfile); } } if ($rslt === false) { header("HTTP/1.1 500 Internal Server Error"); echo "<H2> Error = [Malformed json query ] </H2> \n"; exit; }