As you work with your database, you generate SQL statements. As you define a new table, for example, PowerBuilder builds a SQL CREATE TABLE statement internally. When you click the Create button, PowerBuilder sends the SQL statement to the DBMS to create the table. Similarly, when you add an index, PowerBuilder builds a CREATE INDEX statement.
You can see all SQL generated in a Database painter session in the Activity Log view. You can also save this information to a file. This allows you to have a record of your work and makes it easy to duplicate the work if you need to create the same or similar tables in another database.
To start logging your work:
Open the Database painter.
Select Start Log from the Design menu or the pop-up menu in the Activity Log view.
PowerBuilder begins sending all generated syntax to the Activity Log view.
To stop the log:
Select Stop Log from the Design menu or the pop-up menu in the Activity Log view.
PowerBuilder stops sending the generated syntax to the Activity Log view. Your work is no longer logged.
To save the log to a permanent text file:
Select Save or Save As from the File menu.
Name the file and click Save. The default file extension is SQL, but you can change that if you want to.
Submitting the log to your DBMS You can open a saved log file and submit it to your DBMS in the ISQL view. For more information, see “Building and executing SQL statements”.