Menu

Relation integrity check not working

Help
2011-12-17
2013-03-18
  • nenad cikic

    nenad cikic - 2011-12-17

    I suppose this issue comes from the difference in ABC between clarion 5.5 and clarion 6.
    I have two tables:
    vrsta_mjenjackog_tecaja FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('vrsta_mjenjackog_tecaja'),PRE(vmt),CREATE,BINDABLE,THREAD
    KeyVMT                   KEY(vmt:vrsta_tecaja),NOCASE,OPT,PRIMARY
    KeyVMT_opis_vrsta        KEY(vmt:opis,vmt:vrsta_tecaja),DUP,NOCASE,OPT
    KeyVMT_ind_vrsta         KEY(vmt:indikator_tecaja,vmt:vrsta_tecaja),DUP,NOCASE,OPT
    Record                   RECORD,PRE()
    vrsta_tecaja                STRING(3)
    opis                        STRING(200)
    indikator_tecaja            STRING(1)
                             END
                         END

    tecajevi             FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('tecajevi'),PRE(tec),CREATE,BINDABLE,THREAD
    KeyTEC_dat_broj_valBr_vrsta KEY(tec:tl_datum_tecajne_liste,tec:tl_broj_tecajne_liste,tec:valuta_brojcano,tec:vmt_vrsta_tecaja),NOCASE,OPT,PRIMARY
    KeyTEC_dat_broj_vrsta_valBr KEY(tec:tl_datum_tecajne_liste,tec:tl_broj_tecajne_liste,tec:vmt_vrsta_tecaja,tec:valuta_brojcano),DUP,NOCASE,OPT
    KeyTEC_dat_broj_valBr_minIzn KEY(tec:tl_datum_tecajne_liste,tec:tl_broj_tecajne_liste,tec:valuta_brojcano,tec:minimalni_iznos),NOCASE,OPT
    KeyTEC_valBr_dat_broj_vrsta KEY(tec:valuta_brojcano,tec:tl_datum_tecajne_liste,tec:tl_broj_tecajne_liste,tec:vmt_vrsta_tecaja),DUP,NOCASE,OPT
    KeyTEC_vrsta_dat_broj_valBr KEY(tec:vmt_vrsta_tecaja,tec:tl_datum_tecajne_liste,tec:tl_broj_tecajne_liste,tec:valuta_brojcano),DUP,NOCASE,OPT
    Record                   RECORD,PRE()
    valuta_brojcano             STRING(3)
    kupovni_tecaj               DECIMAL(15,6)
    prodajni_tecaj              DECIMAL(15,6)
    minimalni_iznos             DECIMAL(10,2)
    valuta_slovcano             STRING(3)
    tl_broj_tecajne_liste       LONG
    tl_datum_tecajne_liste      DATE
    vmt_vrsta_tecaja            STRING(3)
    paritet                     LONG
    blokada                     STRING(1)
                             END
                         END 

    I have the relation KeyVMT<->>KeyTEC_vrsta_dat_broj_valBr_vrsta
    On update Restrict, On Delete restrict.
    This is the only relation for VMT. TEC has more relations with other tables. I hope this is not the problem.

    I have template generated brwose/form for VMT. In the update form i have inserted code in just one embedded point, which is in any case not executed. When I change vmt:vrsta_tecaja I get the message about referential integrity being broken, and then i get the Record update error message, asking me if i want to try again or cancel. Till here all OK.

    But if I press No or Cancel, in any case my record is updated.

    Can you check this please? I can obviously manually do the necessary checks, but since it is a basic feature of the templates to do this kind of checks it would be nice to have it.

    Thanks
    Nenad

     
  • Andrew Barnham

    Andrew Barnham - 2011-12-17

    I've never encountered this problem because in my app I only make delete RI restrictive.  And that appears to work fine. 

    For update, all I've ever done is not given the user the ability to modify the fields in the first place. i.e. either make the ENTRY control readonly or delete the control altogether (I generally use numbers with no business meaning as referential keys where possible).

    I will take a look and see what I can discover.

     
  • Andrew Barnham

    Andrew Barnham - 2011-12-17

    Can you please provide me with a sample app that causes the problem.  Can be either your real app, or just a small app that demonstrates the problem.

    Email entire thing to me, including libsrc/.  Then I'll be able to debug.

     
  • Andrew Barnham

    Andrew Barnham - 2011-12-17

    Looking at clarion 5.5 code; looks like update RI check occurs after actual update.

    The RI code will work though, if you enable wrap RI frames in transactions.

    But, currently, in c2j,  LOGOUT/COMMIT/ROLLBACK are not yet implemented. 

    If I fix this oversight, I expect/hope that the bug will disappear.  I will look into it later today.

    Andrew

     
  • nenad cikic

    nenad cikic - 2011-12-18

    I also use always Cascade on update.But in this particular case Restrict on update helps me to adhere to a higher logic in a simple way. I will send you the test app, if you still need it, tomorrow when i get back to work.
    Thanks
    Nenad

     
  • Andrew Barnham

    Andrew Barnham - 2011-12-18

    New commit  to runtime : implemented rollback/commit/logout.  Make sure app is setup so that wrap RI in transaction frames is enabled. And try again.

     
  • nenad cikic

    nenad cikic - 2011-12-19

    Thanks,
    it works now.

     

Log in to post a comment.

Auth0 Logo