SCHEMA
9.4
The SCHEMA instruction executes operations specialized to the runtime schema support. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
name
Required. A previously defined Character String Variable or a literal that specifies the database/schema to be accessed. The 'ipaddr' is optional and if specified redirects the execution of the SCHEMA instruction to the Data Manager. The 'ipaddr' can be a URL or a TCPIP:PORT address.
keyword
Optional. One of the valid keywords defined below.
value
Required. A previously defined Character String Variable that is used by the operation.
Flags Affected: none
Note the following:
The following keywords may be used:
|
Keyword |
Operation |
|
EXPORT={svar} |
Extracts the information from the schema identified by the {name} parameter. If the {svar} is NULL on input, the schema information is stored into the {svar} variable. If {svar} is not NULL on input, it specifies a path/filename where the schema data is stored. |
|
IMPORT={svar} |
Imports schema information from the {svar} variable or from a path/filename that the {svar} string identifies. Any existing information in {svar} is overwritten. |
|
FLAGS={dnumnvarlit} |
A bit mask that changes the execution behavior for the SCHEMA instruction.
A bit mask value of 0x1 causes the IMPORT action to append the schema information without initializing previously defined view data. This is the default action.
A bit mask value of 0x2 causes the IMPORT action to replace the view data in a schema database. This action is performed by deleting a previously defined view and re-inserting the view data from the import data file.
A bit mask value of 0x4 drops any existing Sunbelt schema tables before recreating them.
A bit mask value of 0x8 identifies that the schema file is formatted as a SQLIO xml file. This bit mask value may be used with the IMPORT and EXPORT keywords. |
If the schema {name} has the 'ipaddr' address specified, any data files used for an EXPORT or IMPORT are accessed at the server where the Data Manager is executing. The COPYFILE instruction can store or retrieve schema data files to/from the Data Manager.
The {name} parameter is processed to determine the appropriate connection information that is required to make a connection to a database engine that contains the schema settings. The connection determined from the {name} parameter must be valid for a VIEW when loading a view schema and it must be valid for SQLIO when loading a sqlio schema.
The {name} parameter can be specified as 'Default' to indicate that the schema operations are to use the runtime default schema database connection settings required for a view or sqlio schema as appropriate to the FLAGS settings of the SCHEMA instruction. Also, the {name} parameter can be a user defined database name that has been configured in the default runtime database. If the FLAGS keyword for the SCHEMA instruction are set for SQLIO, the database name must exist in the 'Sun_Sqlio_Database' table. Otherwise, it must exist in the 'Sun_Database' table for a PL/B View.
Example using runtime Default:
Example using user defined Database Connection name:
When the SCHEMA instruction is using the FLAGS setting for SQLIO, the {name} parameter can be specified as a connection string that includes all of the information required to make a direct connection to a database engine that has the SQLIO schema configuration data. (9.6B) In this case, the {name} parameter string can be specified using keywords with assigned string data that can optionally include single or double quote characters.
Format of SCHEMA {name} SQLIO connection string:
The description of the SCHEMA {name} SQLIO connection string keywords can be found in the PL/B Language Reference manual under the section named SQLIO Schema File Format in the '<Database> Schema Record' descriptions.
Example:
When a SCHEMA instruction is executed with a user defined {name}, a connection to the database engine is made and a reference to that connection data exists until the runtime is terminated. In addition, if a second instruction references this {name} parameter database name, the original connection information is used.(9.6B)
When the SCHEMA instruction is executed for a PL/B VIEW, the {name} parameter can be specified as the the SQLite database file name using the keyword named 'HOST=<SQLite File Name>'. In this case, ONLY the 'HOST' keyword is used and any other keywords found in the {name} string are ignored. The SQLite database file is opened for the SCHEMA instruction VIEW processing. The {name} parameter string can be specified with or without single or double quote characters for the HOST keyword.
Format of SCHEMA {name} VIEW database file name string:
The <string> specifies a fully qualified path and file name for the SQLite database file required to process PL/B VIEW data.
Example of PL/B VIEW schema EXPORT for SQLite:
See Also: Disk I/O Instructions
![]() |