>I am currently working on my first Powerbuilder application and there's
>something I don't understand about the default transactionobject SQLCA.
>Suppose I have two sheets open, both referencing SQLCA, and the user can
>make changes to both of them at (more or less) the same time, what would
>happen in the following situation:
>SHEET1, TABLE1: SHEET2, TABLE2:
>starts processing starts processing
>At the end, is the data in table 2 rolled back or committed? If it is rolled
>back the whole idea of a global transactionobject stops making sense to me.
>How do I handle this problem?
First, I can't see how this situation could happen. You can have multiple
sheets open, but only 1 will be active at any given time (it's a Windows
thing). Even if you called your processing for the tables in both sheets
from the same place, your code has to make one process before the other.
You can use "IF...THEN" constructs to commit either only if both updates
are succesful or rollback both if either fails, but still one update
happens before the other. There is a world of difference between "at the
same time" and "more or less at the same time".
Lets make sure were using the same terms here. Your tables are how your
data is organized and stored in your database. In PowerBuilder, what you
see in your window is the DataWindow, or more precisely a DataWindow
object attached to a DataWindow control that sits on a window.
SQLCA, or any transaction object you create yourself, gives your
application information on the data base you're connecting your datawindow
to, or sending embedded SQL to. SQLCA doesn't specify the tables - any
table in the database you set your transaction object to can be accessed
by your transaction object. If you want to access data in another
database other than what SQLCA is set to then you need to create another
So, if you had 2 tables in your database and 2 sheets with a datawindow
looking at at 1 table on one, and a datawindow looking at the other table
on the other then your user can bounce back and forth making changes to
whats in either datawindow and nothings changed in your database tables
until you do an update for a datawindow. Then you can check for success
and decide to commit or rollback.
The point is that SQLCA holds database communication settings and not
table level information. You use SQLCA on any table in the database, but
your updates to the tables cannot happen simultaneously (although you can
programmaticly make the COMMITS happen simultaneously.
>Another question: before this project I was working on databases written in
>Pascal of all things. One of the bigger problems is that I had to deal with
>locking of records myself (you can imagine the horror and misery that arose
>from this). Although I suspect that Powerbuilder (especially when used on
>top of Oracle) handles this well and without my intervention, I must say I'm
>Just how does Powerbuilder handle locking? Is there anything I have to do
>myself? Nowhere in the manuals can I find references to locking or handling
>error conditions which arise from locking. Surely there is something I'm
>And another: I am using a S-Designor for Powerbuilder, and intend to make my
>database run on PC's equipped with Windows 95. The database is Oracle 7, and
>I'm obviously using Powerbuilder. Are there any obvious pitfalls that I
>should beware of?
>I apologize if these are 'stupid' questions or if they are clearly explained
>in one the manuals, but I am currently trying to become (somewhat)
>proficient in all the above tools and I am a bit overwhelmed by the amount
>of information I need to understand.
>Thanks in advance,