From: Joey Schulze Date: Wed, 20 Jan 2010 10:02:10 +0000 (+0100) Subject: Add LiveGrid SQL backend X-Git-Tag: 2010-06-02_customer~267 X-Git-Url: https://git.infodrom.org/?p=misc%2Fkostenrechnung;a=commitdiff_plain;h=4a361d99bd081ea51e3c9bc9d0cef4d5e36d35cc Add LiveGrid SQL backend --- diff --git a/ajax/ricoXMLquery.php b/ajax/ricoXMLquery.php new file mode 100644 index 0000000..4c5713b --- /dev/null +++ b/ajax/ricoXMLquery.php @@ -0,0 +1,61 @@ +\n"; + +require_once('../lib/dbase.php'); +require_once('../lib/dbClass.php'); +require_once('../lib/rico/ricoXmlResponse.php'); + +$id=isset($_GET["id"]) ? $_GET["id"] : ""; +$offset=isset($_GET["offset"]) ? $_GET["offset"] : "0"; +$size=isset($_GET["page_size"]) ? $_GET["page_size"] : ""; +$total=isset($_GET["get_total"]) ? strtolower($_GET["get_total"]) : "false"; +$distinct=isset($_GET["distinct"]) ? $_GET["distinct"] : ""; + +echo "\n"; +if (empty($id)) { + ErrorResponse("No ID provided!"); +} elseif ($distinct=="" && !is_numeric($offset)) { + ErrorResponse("Invalid offset!"); +} elseif ($distinct=="" && !is_numeric($size)) { + ErrorResponse("Invalid size!"); +} elseif ($distinct!="" && !is_numeric($distinct)) { + ErrorResponse("Invalid distinct parameter!"); +} elseif (!isset($_SESSION[$id])) { + ErrorResponse("Your connection with the server was idle for too long and timed out. Please refresh this page and try again."); +} elseif (!OpenDB()) { + ErrorResponse(htmlspecialchars($oDB->LastErrorMsg)); +} else { + $filters=isset($_SESSION[$id . ".filters"]) ? $_SESSION[$id . ".filters"] : array(); + $oDB->DisplayErrors=false; + $oDB->ErrMsgFmt="MULTILINE"; + $oXmlResp= new ricoXmlResponse(); + $oXmlResp->sendDebugMsgs=true; + $oXmlResp->convertCharSet=false; // Database is already in UTF-8 + if ($distinct=="") { + $oXmlResp->Query2xml($_SESSION[$id], intval($offset), intval($size), $total!="false", $filters); + } else { + $oXmlResp->Query2xmlDistinct($_SESSION[$id], intval($distinct), -1, $filters); + } + if (!empty($oDB->LastErrorMsg)) { + echo "\n"; + echo "\n".htmlspecialchars($oDB->LastErrorMsg); + echo "\n"; + } + $oXmlResp=NULL; + # CloseApp(); +} +echo "\n"; + + +function ErrorResponse($msg) { + echo "\n" . $msg . ""; +} + +?>