1. Cesar Lirato
  2. PowerBuilder
  3. Wednesday, 9 March 2022 16:08 PM UTC

Hey Guys.

I try to insert a record in my table,  have a simple program.
I describe the step by step

1.-The user completes the form(Datawindow freeform)

2.-I run update() for the first time

   the program runs and fails, I call rollback in the program.

3.-The user makes the corrections 

4.I run update() a second time
    the program runs and after the dw.update() method, it fails and shows "Row Changed between retrieve and update"

The table has no records, the test is performed by only one user in the system.

WHERE clause for update/delete: key Columns

/*********

user event of window ue_save()  

IF dw_mant.accepttext( ) <> 1 THEN RETURN

IF dw_mant.event ue_valida() = -1 THEN RETURN

IF dw_mant.Update() = -1 THEN

     ROLLBACK using sqlca;

     RETURN

END IF

INSERT STATUS (ID, STATE) VALUES (:al_id, :as_state);

IF SQLCA.SQLCODE<>0 THEN
    ROLLBACK using sqlca;
    MESSAGEBOX("","ERROR" + STRING(sqlca.SQLDBCode)+' ' + sqlca.SQLErrText)
    RETURN 
END IF

 COMMIT;

/**********

Please help me.

 

 

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Thursday, 10 March 2022 09:23 AM UTC
  2. PowerBuilder
  3. # 1

Here is a sample code to update dw

String		ls_msg
Long		ll_rc

ib_dberror = True // instance variable, value set in dw_1's dberror event to false

SQLCA.autocommit = False

ll_rc = dw_1.Update(True, False)

If ll_rc = 1 and ib_dberror = True Then							
	Commit;
	dw_1.ResetUpdate()
Else
        ls_msg = SQLCA.Sqlerrtext
	Rollback;
	MessageBox('Save Failed', ls_msg)
End If
SQLCA.autocommit= True

HTH

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Arthur Hefti Accepted Answer Pending Moderation
  1. Wednesday, 9 March 2022 17:24 PM UTC
  2. PowerBuilder
  3. # 2

Hi

dw_XX.Update() without parameter does an AcceptText() and a ResetUpdate():

integer dwcontrol.Update ( { boolean accept {, boolean resetflag } } )

So you reset the update flags and rollback. The 2nd update does an update instead of an insert.

So it would be  dwcontrol.Update ( TRUE, FALSE)

and do a ResetUpdate() if OK.

Regards
Arthur

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 9 March 2022 16:32 PM UTC
  2. PowerBuilder
  3. # 3

Hi Cesar;

   I suspect that the issue is between the actual Table Structure and how the DWO's Update Properties are being set. You would need to give us a lot more information, such as:

  • DBMS type & version.
  • PB version & build
  • DB Client software used to connect to your DBMS.
  • Table Schema definition (ie: as per the DB Painter)
  • DWO source (update properties)
  • List of any Triggers on the Table
  • etc.

Regards ... Chris

Comment
  1. Cesar Lirato
  2. Wednesday, 9 March 2022 17:36 PM UTC
Thanks Cris



DBMS type & version : Oracle Database 11g Release 11.2.0.4.0 - 64bit

PB version & build : Appeon PowerBuilder Cloud Edition . Version 2017 R2 Build 1756

DB Client software used to connect to your DBMS. : Release 11.1.0.6.0 32bits

Table Schema definition (ie: as per the DB Painter) :

// Profile TESTING_DEV

SQLCA.DBMS = "O10 Oracle10g (10.1.0)"

SQLCA.LogPass = <******>

SQLCA.ServerName = "TESTING"

SQLCA.LogId = "SIGLOG"

SQLCA.AutoCommit = False

SQLCA.DBParm = "PBCatalogOwner='SIGLOG',DecimalSeparator=',',DisableBind=1"

DWO source (update properties) : Key Columns

List of any Triggers on the Table : nothing



Thanks Cris
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 9 March 2022 18:15 PM UTC
Hi Cesar;

Thank you for that information. However, we would still need the full schema definition of the table and the corresponding DWO's update properties. I would suggest taking screen captures of both of these and attaching them to this thread. For the Table, I would use the DB Painter so that we can see the graphic image of the table and its definition in the lower pane.

Regards ... Chris
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.