pddefrev (Generate definition SQL)

Function

The pddefrev command generates a definition SQL for tables, indexes, view tables, alias tables, stored procedures, and triggers defined in the HiRDB system.

The generated definition SQL can be used as an input to the database definition utility. This command generates the definition SQL by starting the dictionary import/export utility (pdexp) internally.

Executor

User with DBA privilege

Format

pddefrev -f control-statements-filename
        -o definition-SQL-output-filename
       [-w work-directory-name]

Options

Specifies the name of the control statements file that contains the tables and stored procedures for which the definition SQL is to be generated. For details about the contents of the control statements file, see Chapter 9. Dictionary Import/Export Utility (pdexp).

Specifies the absolute pathname of the file to which the generated definition SQL is to be output. If the specified file already exists, HiRDB writes the generated definition SQL by overwriting the existing information; if the specified file does not already exist, HiRDB creates it.

Specifies the absolute pathname of the directory to be used for temporary storage of the export file that will be created internally by the pddefrev command in order to export the dictionary. If this option is omitted, /tmp is assumed.

The following is the name of the export file that is created:

pddefrev.exp.HHMMSS

The local time is set in HHMMSS.

Rules

  1. The pddefrev command can be executed only while HiRDB is active.
  2. The pddefrev command must be executed at the server machine containing the single server or the server machine where the system manager is located.
  3. To execute the pddefrev command, you must grant access permissions for the definition SQL output file and work directory to the HiRDB administrator beforehand.

Notes

  1. The results of the pddefrev command can be checked on the basis of the return value and by whether or not there are any error messages. Return code 0 for the pddefrev command indicates normal termination, and return code 8 or 12 indicates abnormal termination.
  2. Only one pddefrev command can be executed at a time. The command cannot be executed while the dictionary import/export utility is executing.
  3. The following table lists the definition SQL statements that are generated by this command:
    TypeIndex definitionComment definitionDefinition SQL to be generated
    Base tableDefinedDefinedCREATE TABLE
    CREATE INDEX
    COMMENT
    Not definedCREATE TABLE
    CREATE INDEX
    Not definedDefinedCREATE TABLE
    COMMENT
    Not definedCREATE TABLE
    View table[Figure]DefinedCREATE VIEW
    COMMENT
    Not definedCREATE VIEW
    Alias table[Figure][Figure]CREATE ALIAS
    Stored procedure[Figure][Figure]CREATE PROCEDURE
    Trigger[Figure][Figure]CREATE TRIGGER
    [Figure]: Not applicable
  4. The definition SQL statements are generated in the order specified in the control statements file.
  5. A semicolon (;) is added at the end of the line of a generated definition SQL statement so that the definition SQL can be used as an input to the database definition utility. end_proc; is added in the case of CREATE PROCEDURE and CREATE TRIGGER.
  6. Definition SQL statements involving any of the following tables, procedures, or functions are not generated:
    • Table definitions containing abstract data types (CREATE TABLE)
    • Index definitions specifying index types (CREATE INDEX)
    • Function definitions (CREATE FUNCTION and system-defined scalar functions)
    • Procedures specifying an abstract data type as a data type for a parameter in a procedure (CREATE PROCEDURE)
    • Procedures calling another procedure from within the procedure definition (CREATE PROCEDURE)
    • A procedure declared in an abstract data type (CREATE TYPE)
    • Procedures calling a function definition (CREATE FUNCTION or system-defined scalar function) from within the procedure definition
  7. When CREATE PROCEDURE is created, the values of the SQL or extended SQL optimization options are generated in decimal format.
  8. Linefeed is performed on the created definition SQL statement in accordance with a condition. For details about the linefeed condition, see 9.3(3) Rules for definition SQL generation.
  9. If you select utf-8 as the character encoding in the pdsetup command, you can use a file with a BOM as the control statement file for pddefrev. Note that even when you do this, the BOM is skipped. No BOM is included in the file that is output by pddefrev.