Announcement

Collapse
No announcement yet.

Scriptcase Form does not correctly handle SQL error containing string WARNING

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scriptcase Form does not correctly handle SQL error containing string WARNING

    I am using SC V9.4.18 + IBM DB2 V11.1 + Apache + linux ubuntu 18.04

    In my database, if the user tries to insert a record that violates a database constrain embedded in a trigger statement, the database manager correctly returns this error:

    SQL0438N Application raised error or warning with diagnostic text: "". SQLSTATE=70006 SQLCODE=-438


    In a form application , during insert, Scriptcase should show the above error on the screen during the insert step, but instead wrongly says "record inserted", which is obviously not true because the database rejected the insert operation.


    I have looked into the generated code by scriptcase and discovered that all errors containing the string WARNING are ignored.


    In fact, looking at the generated code of form_MAXI_REGISTROPRODUZIONE_apl.php, SC generates these lines


    if (FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "MAIL SENT") && FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "WARNING"))
    {
    $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_updt'], $this->Db->ErrorMsg(), true);
    if (isset($_SESSION['scriptcase']['erro_handler']) && $_SESSION['scriptcase']['erro_handler'])
    {
    $this->sc_erro_update = $this->Db->ErrorMsg();
    $this->NM_rollback_db();
    if ($this->NM_ajax_flag)
    {
    form_MAXI_REGISTROPRODUZIONE_pack_ajax_response();
    }
    exit;
    }



    To me this is a bug because if an error message contains the string WARNING it's not handled correctly by SC form app.
    Massimiliano Campagnoli
Working...
X