MySQL Forums
Forum List  »  Sybase

Re: Getting updated rowcount in Powerbuilder
Posted by: Shawn Pleska
Date: September 29, 2009 02:45PM

Peter,

I wish I could help you BUT I haven't gotten any guidance NOR have I figured this out for myself yet. Just two weeks ago, I realized the problem was more severe than I realized.

1. The SQLCode for the transaction object does return a 1 or -1 to indicate if the SQL was processed successfuly so at least that works. Consequently, you know when you issue an update that if the SQL was processed successfully then the update worked. HOWEVER, the SQLNROWS rows-affected value does NOT get returned so you have no way of knowing for sure if the number of rows updated was the same as what you expected. The only way to do that is to issue a followup query checking the rowcount. This is absurd and an absolute waste of processing BUT that's what I had to do in my embedded SQL for the time being.

2. Two weeks ago, I realized that the datawindow.Update function MUST also use SQLNRows internally to determine if the update was successful.

I had a datawindow with update properties set as "Key and Updateable Columns". Let me give you a simple example. I retrieve one row for customer ID 20, customer name Janet Jones. I update the last name on the screen for customer ID 20 to Smith from Jones. Before hitting save, I go into the database behind the scenes and change Janet Jones' last name to Jeffries. I save it. Now, when I save the row with changes on the screen, I should be prompted that the update FAILED because the SQL should update as follows:

UPDATE CUSTOMER SET LAST_NAME = 'SMITH' WHERE CUSTOMER_ID = 20 AND FIRST_NAME = 'JANET' AND LAST_NAME = 'JONES'.

Powerbuilder instead returned an update result code of 1 (SUCCESSFUL). When I looked into the database, I saw that the name was NOT updated to SMITH even though a result code of 1 (SUCCESS) was returned. In the database, the record for customer ID 20 still showed JEFFRIES.

This is a HUGE problem!!!!!!! I can't understand how a bug like this in Powerbuilder in a core area like transaction management has gone unnoticed. If we were working with some low-end DBMS that no one used I could understand. That it's occurring with MySQL is scarie.

I don't have any way of filing a support request with Sybase. I think that's what needs to happen to get this MAJOR issue addressed. Without it being addressed, you can never be sure that an update was actually successful and that it updated the rows it should have.

-Shawn

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Getting updated rowcount in Powerbuilder
7775
September 29, 2009 02:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.