I am attempting to populate a grid from an Oracle database with smartrendering enabled. I believe my problem may be with telling the database to fetch the next 50 rows.
Here is the PHP code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml"); } else {
header("Content-type: text/xml");
}
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
if (!isset($_GET['count']))
$_GET['count']=50;
else
sleep(1);
?>
<rows pos="<?php echo $_GET['posStart']; ?>" total_count="20000">
<?php
$db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xe)))";
$conn = ocilogon('grid','xxxxxx', $db);
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
$sQuery = "SELECT id, item_nm from grid5000 where id between :posStart and :count ";
$stid = oci_parse($conn, $sQuery);
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
oci_bind_by_name($stid, ":posStart", $_GET['posStart'], -1);
oci_bind_by_name($stid, ":count", $_GET['count'], -1);
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
//for($i=0; $i<300; $i++){
print("<row id='r".($row[0]+$_GET['posStart'])."'><cell>".$row[0]."</cell><cell>index is ".($row[0]+$_GET['posStart'])."</cell> <cell>load turn started from ".$row[1]." + ".$_GET['count']."</cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row>");
//}
}
?>
</rows>
The grid is called using the default example for ‘loading big datasets’. What is the counter that is passed via AJAX which I should include in the ‘where’ clause. Oracle does not have a LIMIT statement, so I have created a sequence variable called ID which I can then use as a row number. TIA.