Persistent Rowset timeout

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Persistent Rowset timeout

Doug Hall-6
I'm having an indice out of range error while generating output from a
persistent rowset. It's basically the most used query in our database, on
our most viewed webpage. Caching the results definitely makes sense, here.

It acts like the rowset times out and clears itself while I'm iterating
through it. Is that even possible?

Here is my display code, where I get the indice out of range error:

  $hostname := html.jobs_host_prefix
  // Do not escape the Notes field below, because it can have
  if($qryAds->rowCount = 0)
    %><h3>There are currently no opportunities available.</h3><%
    $alt := true
    while ($qryAds->next)
      $row := $qryAds->getRow
      $alt := not($alt)
      $rowClass := choose($alt; "alt"; "")
      $no_training := choose(($row{"jid"}=0);'<span
      <tr id="job<%=$row{"tid"}%>" class="<%=$rowClass%>">
        <td><%=cell(mac to html($row{"company"};*))%></td>
        <td><%=$row{"city"}+", AL"%></td>
    end while
  end if

Here is my code that builds the persistent rowset:

$rowsetName :="";"Ad";"active")
$qryAds := Rowset.persistent($rowsetName)
if ($qryAds # 0)
  if (not($qryAds->timedOut))
  end if
end if
  $now := timestamp
  query([ad];[Ad]status = "active"; *)
  query([ad]; & ;[ad]StartsAt <= $now; *)
  query([ad]; & ;[ad]EndsAt >= $now)

  order by([ad];[ad]company; > ; *)
  order by([ad];[ad]StartsAt; < ; *)
  order by([ad];[ad]id; <)

  $map := """
  tid:          [ad]id;
  company:      [ad]company;
  endsAt:       `ts.deadline([ad]endsAt)`;
  title:        [ad]JobTitle;
  city:         [ad]city;
  jid:          [ad]jobID;

  $qryAds := RowSet.newFromSelection(->[ad];$map;-1;"";$rowsetName;2) //
refreshes every two minutes
  clear semaphore($semaphore)
end if

If you can spot the problem, I'd appreciate the help. The error doesn't
present itself very often, but when it does, it's front and center -- and

BTW, the ts.deadline routine simply decorates the contents of the ending
date and time with a color, to show urgency. There is no problem with this
method. Also, I'm using the semaphore to prevent the rowset from being
generated by two different requests. We were occasionally getting
duplicated segments of the rowset, otherwise.

Doug Hall
Active4D-dev mailing list
[hidden email]