skip to main content
OpenEdge Development: AppBuilder
AppBuilder Interface : The TEMP-DB database
 
The TEMP-DB database
The recommended method for working with temp-tables in the AppBuilder is to use a special database named TEMP-DB to hold your temp-table definitions. You can use this database to associate a temp-table with a source file that is referenced by the AppBuilder when you construct objects based on that temp-table. The source file is an include file that defines one or more temp-tables.
Note: Your TEMP-DB database must be an OpenEdge Release 10 database. If you have an existing TEMP-DB database from a previous release, you must upgrade it.
There are two standard methods for defining a temp-table. You can use the LIKE phrase to define the temp-table as a copy of a database table, as follows:
 
DEFINE TEMP-TABLE ttmyTable NO-UNDO LIKE myTable.
This approach makes any objects built from that temp-table dependent on a database connection during compilation. To avoid that problem, you can explicitly write out all the FIELD and INDEX phrases in the DEFINE statement, as follows:
 
DEFINE TEMP-TABLE ttMyTable
  FIELD testField1 AS CHARACTER
  FIELD testField2 AS DECIMAL
  INDEX testIndex1 IS PRIMARY testField2 ASCENDING.
The AppBuilder enables you to reference temp-tables using both methods. However, by default, the TEMP-DB Maintenance tool uses fully written out DEFINE statements to avoid the database dependency at compile time.
Because the TEMP-DB database associates a temp-table with an include file, the AppBuilder can write that include file into the objects that you create from that temp-table. The generated code looks like the following:
 
/* Temp-Table and Buffer definitions                                    */
{app1/ttMyTable.i}
You can now maintain the temp-table definition in the include file and avoid manually updating every object that uses the temp-table.
Several AppBuilder tools, such as the Query Builder and Column Editor, rely on the TEMP-DB database connection when building objects based on temp-tables. These tools use the metaschema of the TEMP-DB database to provide lists of available fields. Therefore, it is important that the definitions in the temp-table include files always match the TEMP-DB table definitions.
To simplify using temp-tables, the AppBuilder now includes a TEMP-DB Maintenance tool. This tool enables you to:
*Define new temp-tables by associating include files of temp-table definitions with tables in the TEMP-DB database and updating the TEMP-DB database schema to match the include file definitions.
*Compare the include file for a temp-table with the TEMP-DB database definition.
*Rebuild an existing TEMP-DB schema table definition to match the associated include file for a temp-table.
*Import temp-tables into the Progress Dynamics® Repository.
Creating a TEMP-DB database
The TEMP-DB database has a control table, temp-db-ctrl, that associates temp-table definitions and their include files. When you launch the TEMP-DB Maintenance tool for the first time with your TEMP-DB database, the system adds the control table to the database schema. The tool maintains the TEMP-DB schema and control table from that point.
Caution: Never use the Data Dictionary to maintain the TEMP-DB database. The new tool works by synchronizing the contents of include files with the database. If you use the Data Dictionary to modify the TEMP-DB database, the database’s contents will not match up with the source files.
To create a TEMP-DB database:
1. Start the Data Administration tool.
2. Choose DatabaseCreate. The Create Database dialog box appears:
3. Type TEMP-DB for the New Physical Database Name. By default, the database is created in your working directory.
4. Select An EMPTY Database from the Start with radio set.
5. Click OK to create the database. The Connect Database dialog box appears:
6. Click Cancel and close the Data Administration tool.
Your TEMP-DB database is just an empty database now. The TEMP-DB Maintenance tool checks that the TEMP-DB database has the appropriate control table in the schema when you launch the tool. If the control table is not present, the tool can apply the schema for you.
Note: If you have an object open in the AppBuilder that references the TEMP-DB database, be aware that the session needs to restart after the change to the TEMP-DB database. An error box will appear when the schema change is complete. When you click OK, your session terminates and the AppBuilder restarts. In general, you should close any open objects before using the TEMP-DB Maintenance tool.
To apply the schema to your TEMP-DB database:
1. Choose ToolsTEMP-DB Maintenance Tool from the AppBuilder main window. A dialog box appears asking if you want to connect to the TEMP-DB database:
2. Click OK. The Connect Database dialog box appears.
Note: Since the TEMP-DB Maintenance tool performs online schema changes to the TEMP-DB database, you must connect to the TEMP-DB database in single-user mode.
3. Type the appropriate values for your database and click OK. A dialog box appears asking if you want the control table added to the database’s schema:
4. Click OK to load the control table. The TEMP-DB Maintenance window appears:
Your TEMP-DB database is now ready to use.