1. Rachid Sbaibi
  2. PowerBuilder
  3. Tuesday, 20 September 2022 17:19 PM UTC

Hi all,

I insert a row in a datawindow, the the datawindow is updated (dw_1.update()). When a commit is triggered in my script no data is inserted in the database and I got no error.

The same code works fine for Oracle database.

dw_rowcount() = 1

Can someone have an idea?

Regards.

Rachid.

Rachid Sbaibi Accepted Answer Pending Moderation
  1. Wednesday, 21 September 2022 13:14 PM UTC
  2. PowerBuilder
  3. # 1

AUTOCOMMIT is OFF

Here is a screenshot that may be will help. You can see that idw_operation contains one row

Comment
  1. Sivaprakash BKR
  2. Thursday, 22 September 2022 04:59 AM UTC
Also sqlnrows = 0. Something at the database level makes the record to get rejected. Check for any constraint or before trigger.
  1. Helpful 1
  1. Rachid Sbaibi
  2. Thursday, 22 September 2022 16:41 PM UTC
I disabled all the triggers for this table, but unfortunately always the same error.

Finally, I found that there were lot of database errors happening before inserting my row and prevents the COMMIT. In the transaction objet dberror event, only some error codes were catched. After fixing the other errors, I can now insert my rows.

Thanks to you all.
  1. Helpful 1
  1. John Fauss
  2. Thursday, 22 September 2022 18:17 PM UTC
That is great news, Rachid! Thanks for letting us know the cause. Would you please take a moment and mark this issue as resolved? Thank you!
  1. Helpful 1
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 21 September 2022 05:50 AM UTC
  2. PowerBuilder
  3. # 2

Rachid,

Ensure whether
1.  The Table got any constraint that makes the data to rollback
2.  Check for any dbErrors in DBError event
3.  Try inserting the same row with same values from PGAdmin and see any error gets displayed.
4.  Finally, ensure that you are checking the same database, same server where PB is inserting the row.  [ It happens to me, since we connect to PG via IP address ]

HTH

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 21 September 2022 03:00 AM UTC
  2. PowerBuilder
  3. # 3

Hi,

So if I understand well, you do a COMMIT, but changes are not being commited.

What about your connexion parameters for SQLCA?

Is autocommit ON or OFF?

regards

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 20:18 PM UTC
  2. PowerBuilder
  3. # 4

Hi Rachid;

   Please make sure that your App...

  1. You App code checks the return code of the Update() command for "success".
  2. The DW Control or DataStore has the DBError event coded to trap any DML processing issues.
  3. The DW Control or DataStore has the Error event coded to trap any column value assignment issues.

Regards ... Chris

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 18:36 PM UTC
  2. PowerBuilder
  3. # 5

I'm using PostgreSQL and do not have that issue.

Please post your code so we can see what is occurring. Also, please checj the STATE of the row prior ro issuing the UPDATE.


dwitemstatus    ldw_itemstatus

ll_row                 = dw_1.GetRow ()
ldw_itemstatus = dw_1.GetItemStatus (ll_row, 0, Primary!)

IF (ldw_itemstatus = NewModified! OR ldw_itemstatus = DataModified!) THEN

   ll_rc = dw_1.Update (TRUE, TRUE)

END IF

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 18:34 PM UTC
  2. PowerBuilder
  3. # 6

Hi, Rachid -

Run a database trace from your app (preface the SQLCA.DBMS property value with the word "TRACE", such as SQLCA.DBMS = "ODB" becomes SQLCA.DBMS = "TRACE ODB", for example).

Examine the contents of the trace file to see what it tells you.

Another idea is to open the DataWindow data object in the DW Painter, insert a row in the Preview pane and manually populate the row with the same values as what is being attempted in the application, then save the new row via Rows -> Update menu item. You should be sure your PB Database Profile uses the same settings as your application.

Best regards, John

Comment
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.