Adding, editing, or deleting columns

Resource tables and columns must conform to the specifications of your database vendor. When you are creating or editing a column, keep in mind that if you create an invalid data type for your chosen database, no error message will be displayed since no error checking is performed. Also note that run-time managers are optimized for a specific database vendor and must be regenerated if you change your vendor.

Adding, editing and deleting columns only affects the resource model and the generated classes. It does not affect the underlying table in the database. Tables must be dropped and recreated and resources must be unregistered and reregistered in order for changes to take effect.

To add a new column that is not already defined as part of the table:

  1. You can either click the Create Column button or you can right-click anywhere within the Available Columns or Selected Columns fields and click Create Column.

  2. Type the column name and display name.

  3. In the SQL type list, click the SQL type you want to use. Make sure the SQL type is applicable for your database and protocol.

  4. Click nullable or not nullable. Click not nullable if the column is a necessary entry. Click nullable if the entry is not necessary. For example, a column in the EMPLOYEE table is named NAME (EMPLOYEE.NAME). Another column is named HOMEPHONE (EMPLOYEE.HOMEPHONE). Since NAME is a necessary value in the table, that column is a not nullable value. HOMEPHONE is not a necessary entry, so it is nullable.

  5. Select default value if you want to specify a default. If you do not specify a default value, null is used as the default.

  6. Type the length. The length is only applicable for certain SQL types, such as VARCHAR.

  7. Type the precision. The precision is the total number of decimal digits allowed in a value.

  8. Type the scale. The scale specifies the number of decimal digits allowed after the decimal point in a DECIMAL or NUMERIC column.

  9. Click regular initialization if the value for the column should be set into the resource object when first initialized. Click lazy initialization if the value for the column should be set into the resource object when first needed. Lazy initialization defers long running database operations until they are required. Lazy initialization is often faster if you do not always access the lazy initialized column when accessing a resource. On the other hand, if the lazy initialized column is always accessed whenever a particular resource is retrieved, especially if many rows are retrieved on a single query, lazy initialization may actually perform slightly slower. If you are unsure about how this resource will be used, accept the default. You can always change this value later by double-clicking on the .hrf, editing this column, and regenerating the resource. Lazy initialization is only applicable for BLOBs and CLOBs.

To edit a column:

  1. Double-click on a column.

  2. Type the column name and display name.

  3. In the SQL type list, click the SQL type you want to use. Make sure the SQL type is applicable for your database and protocol.

  4. Click nullable or not nullable. Click not nullable if the column is a necessary entry. Click nullable if the entry is not necessary. For example, a column in the EMPLOYEE table is named NAME (EMPLOYEE.NAME). Another column is named HOMEPHONE (EMPLOYEE.HOMEPHONE). Since NAME is a necessary value in the table, that column is a not nullable value. HOMEPHONE is not a necessary entry, so it is nullable.

  5. Select default value if you want to specify a default. If you do not specify a default value, null is used as the default.

  6. Type the length. The length is only applicable for certain SQL types, such as VARCHAR.

  7. Type the precision. The precision is the total number of decimal digits allowed in a value.

  8. Type the scale. The scale specifies the number of decimal digits allowed after the decimal point in a DECIMAL or NUMERIC column.

  9. Click regular initialization if the value for the column should be set into the resource object when first initialized. Click lazy initialization if the value for the column should be set into the resource object when first needed. Lazy initialization defers long running database operations until they are required. Lazy initialization is often faster if you do not always access the lazy initialized column when accessing a resource. On the other hand, if the lazy initialized column is always accessed whenever a particular resource is retrieved, especially if many rows are retrieved on a single query, lazy initialization may actually perform slightly slower. If you are unsure about how this resource will be used, accept the default. You can always change this value later by double-clicking on the .hrf, editing this column, and regenerating the resource. Lazy initialization is only applicable for BLOBs and CLOBs.

To delete a column, right-click a column and click Delete Column.



 

Back