gnuherds-app-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Federico's tasks -- out of range error


From: Davi Leal
Subject: Re: Federico's tasks -- out of range error
Date: Mon, 20 Oct 2008 22:41:47 +0200
User-agent: KMail/1.9.9

> You could propose a patch to do the out-of-range check at Layer-5, for the
> View_Job_Offer case [1].
>
>   [1] http://gnuherds.org/View_Job_Offer.php?JobOfferId=2812245432435243

Problem
=======

The webapp shows and error message which the user will not understand:

ERROR:
 PREPARE query(integer) AS  SELECT count(*) FROM J1_JobOffers WHERE
 J1_Id=$1 AND J1_Closed='f' AND J1_ExpirationDate > 'now';  EXECUTE
 query('2812245432435243'); 

ERROR: value "2812245432435243" is out of range for type integer 



Proposed solution
=================

At Layer-5__DB_operation/PostgreSQL.php you can see the below lines.

  // Check for query error
  if (strlen ($r=pg_last_error ($GLOBALS["PG_CONNECT"])))
  {
    $error = "ERROR:<pre> {$sqlQuery} </pre> {$r}"; // DEBUG
    // $error = "$r"; // No DEBUG
    throw new Exception($error,true);
  }

Note the line flagged as DEBUG.  We could add some check to know
if the error is an out-of-range error, and then instead of:
    $error = "ERROR:<pre> {$sqlQuery} </pre> {$r}"; // DEBUG
show:
    $error = gettext("Value out out range")." ".gettext("Please, try again.");

So the webapp shows and error message which any user will understand. What do 
you think?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]