Home page  
Help >
ddlVerify() - retrieve data base meta information
Version 7.11
ddlVerify() - retrieve data base meta information ddlVerify() - retrieve data base meta information

The purpose of the ddlVerify() API function is to retrieve several types of data base meta information.

Prototype:
   void ddlVerify(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList);          /* command argument list */

Notation standards Options Answers

Syntax:
Form 1: ASSERT
Form 2: COLLECTION cxname [table-name | table-alias]
Form 3: COLLECTION cxname n
Form 4: DBD
Form 5: DBMODE
Form 6: DGNAME table-name [MAX | LOADED | ACTIVE | LENGTH | TEMP | PAGESIZE]
Form 7: DGNAME number
Form 8: DGNAME table-name MEMO
Form 9: SIGNATURE [table-name] fieldname [LENGTH | POINT | TYPE | POSITION | ...
             KEY/KEYINFO/KEYTOTAL/KEYTYPE/KEYLEN]
Form 10: SIGNATURE table-name number
Form 11: STRUCTURED [fieldname]
Form 12: STRUCTINFO [ITEMSREAD | ITEMSINSERTED | ITEMSDELETED] ...
             NODESMODIFIED | NODESINSERTED | NODESDELETED
             LISTSMODIFIED | LISTSINSERTED | LISTSDELETED
Form 13: UNIQUE <key-name> [<seed-value>]
Form 14: VERSION
Form 15: VERSIONINFO

Form 1: ASSERT
VERIFY ASSERT returns the count of asserts, and details of the most recent assert. However, it functions only in the Release and Release-Diag versions. Each invocation of VERIFY ASSERT clears the assert count and detail attributes.

ctl.Ans1str[]                ="OK"
ctl.Ans2                      =Number of asserts
ctl.Ans2str[]                =Most recent assert code
ctl.Ans3str[]                =API function associated with most recent assert

Form 2: COLLECTION cxname [table-name | table-alias]
If the collection cxname does not exist:
ctl.Ans1str[]                ="NO"

If the collection cxname exists and no table-name or table-alias is specified:
ctl.Ans1str[]                ="OK"
ctl.Ans2                      =Current Hierarchy level
ctl.Ans3                      =Total number of tables & table aliases in collection cxname

If the collection cxname exists and table-name/table-alias does not exist:
ctl.Ans1str[]                ="NO"

If the collection cxname exists and table-name exists:
ctl.Ans1str[]                ="OK"
ctl.Ans2str[]                =table-name
ctl.Ans3str[]                =table-name

If the collection cxname exists and table-alias exists:
ctl.Ans1str[]                ="OK"
ctl.Ans2str[]                =table-name
ctl.Ans3str[]                =table-alias

Form 3: COLLECTION cxname n
If the collection cxname exists and n exceeds the number of tables and table aliases in the collection:
ctl.Ans1str[]                ="NO"

If the collection cxname exists and n does not exceed the number of tables and table aliases in the collection:
ctl.Ans1str[]                ="OK"
ctl.Ans2str[]                =table-name
ctl.Ans3str[]                =table-name/table-alias

Form 4: DBD
ctl.Ans1str[]                ="OK" if database is open, "NO" if not
ctl.Ans2str[]                =Source DBD filename if the database is open, null if not
ctl.Ans3str[]                =The path leading up to the DBD filename, null if not open

DBD GROWROOM
ctl.Ans1                =Grow record count for DRL; Ref DBOPTION Gnnn and DBDCOMP/S.
Form 5: DBMODE
ctl.Ans1str[]                =READ if open read only, WRITE is open for write, "NO" if not open
ctl.Ans2str[]                =The source PI filename if database is open, null if not
ctl.Ans3str[]                =The path leading up to the PI filename, null if not open

Form 6: DGNAME table-name [MAX/LOADED/ACTIVE/LENGTH/TEMP/PAGESIZE]

Options:
                /N              - use schema that excludes virtual columns
                /T               - use token map internal name

Values returned in Control Structure:
Control.Ans1str[] "OK" if table-name exists, "NO" if not, or is not in PI.
Control.Ans2 Parameter:
<empty>       Zero
MAX:           Maximum number of records in the table
LOADED:    Current highest record number in the table
ACTIVE:      Number of active records in the table
                     (LOADED minus number of deleted records)
LENGTH:     The length of the record
                     [If /N option is not present, LENGTH includes virtual columns]
                     [If /N option is present, LENGTH excludes virtual columns]
PAGESIZE: The page size for the table: 4096, 8192, 16384, 32768, 65536
Control.Ans3str[] If token map and not /T option: token map internal name;
If token map and /T option: token map external name;
Control.Ans4L LockID (this is an internal parameter used by the Linux version);
Form 7: DGNAME n (where n is a number)
This function returns the name of each table by integer; and also returns the number of tables.

for n = 0, or n greater than the number of tables in the database:
       ctl.Ans1str[]       - "NO"
       ctl.Ans2             - Zero
       ctl.Ans3             - The number of tables in this database

for n = Index: [Index ≥ 1 and Index ≤ number of tables]
       ctl.Ans1str[]       - contains the name of the Indexth table
       ctl.Ans3str[]       - for token mapped data bases, contains the internal name of the Indexth table
Form 8: DGNAME table-name MEMO
ctl.Ans1str[]                ="OK" if "table-name" contains one or more MEMO fields, "NO" if not

Form 9: SIGNATURE [table-name] fieldname [LENGTH/POINT/TYPE/POSITION/...
                                                                                 KEY/KEYINFO/KEYTOTAL/KEYTYPE/KEYLEN]


ctl.Ans1str[]                - "OK" if fieldname exists, "NO" if it does not
                                     [If /N option is not present, both virtual and non-virtual columns are included.]
                                     [If /N option is present, only non-virtual columns are included.]
ctl.Ans3str[]                - for token mapped data bases, contains the internal name of the Indexth column in the table

The values of the remaining answer cells depend on the qualifier:
if NOTHING: ctl.Ans2 contains this field's level number; and, if the field is virtual, ctl.Ans2str[] contains the literal "virtual"
if LENGTH: ctl.Ans2 contains the total length of field.
For VARCHAR(n[.d]), ctl.Ans2 is the value of d; ctl.Ans3 is the value of n.
if POINT: for data type N(), ctl.Ans2 contains the number of fractional positions; for data type LOGICAL, ctl.Ans2 is the 0-relative bit position [with the high order bit being bit 0];
if TYPE: ctl.Ans2 contains the field type as an integer code; the symbolic codes are defined by the DdDataType enum{} in ddl_defs.h
ctl.Ans2str[] contains the field type as a string: "X", "N", "I", "ID", "ID64", "F", "FD", "LOGICAL", "DATE", "MEMO", "DOC"
if POSITION: ctl.Ans2 contains the 0-relative starting byte position in the record
[If /N option is not present, position is relative to the virtual record.]
[If /N option is present, position is relative to the non-virtual record.]
if KEY: ctl.Ans2str[] contains "KEY" if field is a key, "NO" if not;
if field is a key:
        ctl.Ans3str[] contains a comma separated list of key attributes
               d - discrete;
               i - identity (auto increment);
               n - PROFILE mode;
               p - primary;
               r - realtime;
               s - (case) sensitive;
               v - virtual;
               x - external (i.e., User Defined);
               S - significant;
               V - variable length;
               dd [8, 16, 32, 64] - cell size [8K, 16K, 32K, 64K];
        ctl.Ans4L - LockID (this is an internal parameter used by the Linux version); Note that in this case, a table-name must be specified.
if KEYINFO: if field is a key:
        ctl.Ans2 contains the Uniqueness;
        ctl.Ans3 contains the number of records Structured
        ctl.Ans4L contains the block size in bytes
        ctl.Ans5L contains the number of blocks used
        ctl.Ans6L contains the actual file length
Note that in this case, a table-name must be specified.
if KEYINFORTL: if field is a REALTIME key:
        ctl.Ans2 contains the Uniqueness;
        ctl.Ans3 contains the number of records Structured
        ctl.Ans4L contains the RTL block size in bytes
        ctl.Ans5L contains the RTL number of blocks used
        ctl.Ans6L contains the RTL actual file length
Note that in this case, a table-name must be specified.
if KEYTOTAL: if field is a key:
        ctl.Ans2 contains the Uniqueness;
        ctl.Ans3 contains the total of all counts
Note that in this case, a table-name must be specified.
if KEYTYPE: ctl.Ans2 contains the type of the index data item as an integer code; the symbolic codes are defined by the DdDataType enum{} in ddl_defs.h
ctl.Ans2str[] contains the type of the index data item as a string: "X", "I", "ID", "ID64", "F", "FD"
Note that the type of the index data item may not be the same as the type of the data field.
Note that in this case, a table-name must be specified.
if KEYLENGTH: ctl.Ans2 contains the length of index data item.
Note that in this case, a table-name must be specified.

Form 10: SIGNATURE table-name n (where n is a number)
This function returns the name of each column within a table by integer; and also returns the number of columns in a table.

for n = 0, or n greater than the number of columns in the table:
       ctl.Ans1str[]       - "NO"
       ctl.Ans2             - Zero
       ctl.Ans3             - The number of columns in the table
                                   [If /N option is not present, this includes virtual columns]
                                   [If /N option is present, this excludes virtual columns]

for n = Index: [Index ≥ 1 and Index ≤ number of columns in table]
       ctl.Ans1str[]       - contains the name of the Indexth column in the table
                                   [If /N option is not present, this includes virtual columns]
                                   [If /N option is present, this excludes virtual columns]
       ctl.Ans2str[]       - if the Indexth column is virtual, contains the literal "virtual"
       ctl.Ans3str[]       - for token mapped data bases, contains the internal name of the Indexth column in the table

Form 11: STRUCTURED [fieldname]
This is used to find out if the database is fully structured, or if a given field is fully structured.

If no fieldname is specified and the database is fully structured:
ctl.Ans1str[]                ="OK"

If no fieldname is specified and the database is not fully structured:
ctl.Ans1str[]                =NO
ctl.Ans2str[]                =PART for partial structure, or NOT for no structure
ctl.Ans3str[]                =The name of the first key encountered that was not structured
                                or partially structured. The %answer2 applies for this field.

If a fieldname is specified and it is fully structured:
ctl.Ans1str[]                ="OK"

If a fieldname is specified and it is not fully structured:
ctl.Ans1str[]                =NO
ctl.Ans2str[]                =PART for partial structure, NOT for no structure
ctl.Ans3str[]                =The fieldname

Form 12: STRUCTINFO [ITEMSREAD | ITEMSINSERTED | ITEMSDELETED] ...
             NODESMODIFIED | NODESINSERTED | NODESDELETED
             LISTSMODIFIED | LISTSINSERTED | LISTSDELETED

There is a special set of counters that are used to record details of ddlStructure() and ddlStructureMem() functions. These counters are initialized to zeroes when either of these functions is invoked. After termination of the function, they can be queried with ddlVerify() STRUCTINFO.

Syntax:
                VERIFY STRUCTINFO <counter-name>

      Permitted <counter-name> values:
         ITEMSREAD     - the number of records read; or in the case of an
                         EXTERNAL index, the number of meta records read;
         ITEMSINSERTED - the number of list items inserted;
         ITEMSDELETED  - the number of list items deleted; [PURE index only];
         NODESINSERTED - the number of nodes inserted;
         NODESDELETED  - the number of nodes deleted; [PURE index only];
         NODESMODIFIED - the number of nodes that had list items added or deleted;
         LISTSINSERTED - the number of RTL list nodes added; [REALTIME index only];
                         this is used primarily for debugging;
         LISTSDELETED  - the number of RTL list nodes deleted; [REALTIME indexes only];
                         this is used primarily for debugging;
         LISTSMODIFIED - not used at present

Answers:
                ctl.Ans1str[]                ="OK"
                ctl.Ans2                      =Requested count

Form 13: UNIQUE <key-name> [<seed-value>]

The purpose of VERIFY UNIQUE is to create a guaranteed unique and registered value for the specified key. Registered means that it is posted in the structure and it will not be given to any other simultaneous user who may be requesting a value for the same key [via VERIFY UNIQUE]. This is the only way to get a guaranteed unique value.

Syntax:
                VERIFY/options UNIQUE <key-name> [<seed-value>]

Options:
                /D               - Deregister an unused value
                /P               - Deregister all unused values (must be the only user)

Answers:
                ctl.Ans1str[]                ="OK" or "NO"
                ctl.Ans2str[]                =The unique and registered value (if ctl.Ans1str[]="OK", else zero)

Description:
The operational mode of VERIFY UNIQUE depends on the presence or absence of the optional parameter <seed-value>. Each mode has its own advantages and disadvantages.

When the <seed-value> is present, VERIFY UNIQUE begins searching the index at the specified value, and continues incrementing and searching until it finds a value that does not already exist in the index. It then reserves that value in the index, and returns the value to the caller.

The primary advantage of this mode is that it eliminates gaps in the index values.

The primary disadvantage of this mode is that it becomes increasingly inefficient as the number of nodes increases.

When the <seed-value> is not present, VERIFY UNIQUE takes the high value of the index and uses that value as the seed.

The primary advantage of this mode is that it is very efficient.

The primary disadvantage of this mode is that it may leave gaps in the index values.

There is one case where the <seed-value> is required; that is the case when the index is empty. Invoking VERIFY UNIQUE without the <seed-value> parameter when the index is empty will result in a "NO" response.

A fairly simple algorithm for dealing with that scenario is:
      VERIFY UNIQUE <key-name>
      IF %Answer EQ "NO"
        VERIFY UNIQUE <key-name> <seed-value>
      ENDIF
This algorithm uses the more efficient no-<seed-value> mode while dealing with the special case initialization.

For a character field, [X() data type], the <seed-value> may consist of an optional alpha prefix, followed by one or more digits. When, in the incrementing process, the digit portion reaches all 9's, additional digits will be appended to the right end of the string, if the key size permits. If the numeric portion reaches all 9's, and if no further expansion to the right is possible, the function returns a "NO" response.

If the <seed-value> does not include a numeric suffix, and if the value does not already exist in the index, the value is reserved and returned to the caller. If the value does already exist in the index, the function returns a "NO" response.
Form 14: VERSION
ctl.Ans1str[]                =The primary version number
ctl.Ans2str[]                =The OS that this version is running on
ctl.Ans3str[]                =The sub version number
                                e.g., For version 4.1.6 %answer=4.1, %answer3=6

Form 15: VERSIONINFO
ctl.Ans1 contains the maximum number of users (per data base) that this version will allow.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.