Page 459
Power Objects is supported on all three Windows platforms (Windows 3.11, Windows 95, and Windows NT) and the Macintosh platform (System Software Version 7.1.1, 7.1.2, or 7.5.3 and later). The material in this lesson and the next one will emphasize the use of Power Objects Version 2.0 on Windows 95.
To construct a Power Objects application, you will manipulate these objects:
Page 460
The best way to learn about Power Objects is going through the steps of building an application. To start the Power Objects Designer, select Start | Programs | Oracle Power Objects 2.0 | Power Objects Designer; Figure 17.1 displays the initial window presented by Power Objects Designer. The Power Objects desktop is composed of four main areas:
Figure 17.1. Page 461
Power Objects
Designer initial
window.
The starting point in creating a new application is to create a new database session. To do this, you can either select File | New Session from the menu or click on the New Session icon on the toolbar (it looks like an electrical plug). A window will appear, labeled Create Session, which contains four fields:
Database | By default, it will be set to Oracle. |
Username | The name of the Oracle account you want to connect to (enter Flugle). |
Password | The password for the Oracle account contained in Username (enter Flugle). |
Connect string | If you are using Personal Oracle, leave this field blank. If you are connecting to an Oracle server on another machine, enter the appropriate database alias. |
Once you have entered the appropriate values in the fields, click OK to create the database session.
Figure 17.2.
Creating a new
session.
Once the new session is created, the property sheet for the Flugle database session will appear on the desktop (see Figure 17.3).
In the Main window, you will see the new database session. As usual, click the +. As you can see in Figure 17.4, all the database objects owned by the Flugle account are displayed in the Main window.
Page 462
Figure 17.3.
Power Objects session
property sheet.
NOTE |
It's important to realize that each object has its own set of properties. For example, the properties defined for a session object are distinct from the properties defined for an application object. (Of course, an application object property might name a session object.) |
Each object type is displayed with a different icon. For example, the icon for a table looks like a grid (Schedule_Type, for instance). The icon for a view looks like two tables joined together (Student_No_Personal, for instance). To display the definition of a table, double-click the icon to the left of the table name; a window will appear that contains the table definition. For instance, Figure 17.5 displays the definition for the Schedule_Type table. Notice the key icon to the left of the Schedule_ID column, signifying that the column is the primary key. You can modify the definition of a table, subject to the restrictions that were discussed in the lesson in Day 4, "Implementing Your Logical Model: Physical Database Design." If you do modify the table definition, Power Objects will ask you to confirm that you want to save the changes you have made.
Page 463
Figure 17.4.
Power Objects
application property
sheet.
Figure 17.5. Page 464
Viewing a table
definition in the
Main window.
NOTE |
When you expand a database session, you can create new database objects, such as tables, indexes, and views, by either making a menu selection (such as Object | New Table) or by pressing the appropriate icon on the toolbar (the fourth group of icons from the left). |
Power Objects also will let you view or modify the contents of a database object, such as a table. As an example, if you double-click on the table icon to the left of the Student table, Power Objects will display the definition for the Student table. If you want to view or modify the contents of the Student table, you can do any of the following:
You will then see a window, labeled Browsing Table - STUDENT, which contains the contents of the Student table (see Figure 17.6).
Figure 17.6. Page 465
Viewing the contents
of the Student table.
From this window, you can also modify the contents of a table. For example, if you wanted to set Anna Anastatia's middle initial to Q (for Quinn), you would click on the MI field in that record and make the change. As shown in Figure 17.7, Power Objects enables you to make the change and also locks the record, as evidenced by the lock icon placed on the left of the record. You can also insert a row or delete a row either by selecting the appropriate menu item within the Database menu item or by clicking the + or - icon on the toolbar.
NOTE |
When you modify a record either by creating it, changing one of its fields, or deleting it, Power Objects will place a row-level lock on it. This lock won't prevent other users from viewing the record, but it will prevent them from modifying it until you commit or rollback the changes you have made. |
Figure 17.7.
Changing a row in
the Student table with
Power Objects
Designer.
If you try to close the window labeled Browsing Table after you have changed the contents of the table, Power Objects will inform you that a transaction is pendingyou must either commit the changes that you have made or roll back the changes (see Figure 17.8). You can perform a commit or rollback either by selecting the appropriate menu item within the Database menu item or by pressing the appropriate icon on the toolbar (the commit icon is a green checkmark, and the rollback icon is a purple curved arrow).