• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

dbconstants, dbquery_codes - Datascope codes for dbquery and database pointers

DESCRIPTION

Various constants are used in Datascope, most of them by dbquery as codes for extracting particular information from the schema file. In addition, a few are used in database pointers to indicate special records or all records. Some codes are used in some modify operations like dbsort(3) and dbjoin(3).

Database pointers

dbsort constants

dbquery codes

dbDATABASE_COUNT
dbTABLE_COUNT
dbFIELD_COUNT
dbRECORD_COUNT
These return counts of the number of databases open, the number of tables in a database, the number of fields in a table, and the number of records in a table.
dbSCHEMA_DESCRIPTION
dbDATABASE_DESCRIPTION
dbTABLE_DESCRIPTION
dbFIELD_DESCRIPTION
These return pointers to a short description of the schema, database, table or field.
dbSCHEMA_DETAIL
dbDATABASE_DETAIL
dbTABLE_DETAIL
dbFIELD_DETAIL
These return pointers to a verbose description of a schema, database, table or field.
dbSCHEMA_NAME
dbDATABASE_NAME
dbTABLE_NAME
dbFIELD_NAME
These return pointers to the name of a schema, database, table or field.
dbSCHEMA_DEFAULT
returns the default schema used when opening a database.
dbTABLE_SIZE
dbFIELD_SIZE
dbRECORD_SIZE
These return the size in bytes of a table, field or record. (For a view, this is the size of the space used to hold the Dbptr's which make up a record, not the total length of all the fields from a record of each table which makes up the view).

dbFIELD_TYPE
returns the type of a field, which may be: dbREAL, dbINTEGER, dbTIME, dbDATE, dbYEARDAY, dbSTRING, or dbDBPTR.

dbFIELD_RANGE
returns the expression which describes the legal values of the field.

dbFIELD_FORMAT
returns pointer to printf style default print format for field.

dbFIELD_INDEX
returns integer index of field in record, where the first character is numbered zero.

dbDATABASE_FILENAME
returns pathname of database (corresponds to descriptor file if one exists).

dbDATABASE_FILES
returns array of table filenames indexed by table name.

dbTABLE_FILENAME
dbTABLE_DIRNAME
returns the filename or directory of a table (the actual filename if it exists, or the name of the file that would be created if a record were added.) You can tell if a file exists by the count of records.

dbTABLE_CREATION
returns a dbprocess(3) like string which shows how the view was created.

dbVIEW_TABLES
returns a Tbl list of the tables which make up the view.

dbVIEW_TABLE_COUNT
returns the number of tables which make up the view.

dbDBPATH
returns the database path for the specified database.

dbFORMAT
returns the preferred print format for the specified field.

dbFIELD_UNITS
returns a pointer to a string specifying the units for the field.

dbNULL
returns a pointer to a string specifying the null value for the field.

dbPRIMARY_KEY
dbALTERNATE_KEY
dbFOREIGN_KEYS
returns a Tbl pointer which contains the field names (for the specified table) of the primary and alternate keys, or the field names corresponding to foreign keys. This could be useful in automating joins or more complex operations on a database.

dbTABLE_FIELDS
returns a pointer to a Tbl which contains the names of the fields in the table.

dbFIELD_TABLES
returns a pointer to a Tbl which contains the names of all tables which contain the specified field. See also dbtables(3).

dbSCHEMA_FIELDS
returns a pointer to a Tbl which contains the names of all the fields in the schema.

dbSCHEMA_TABLES
returns a pointer to a Tbl which contains the names of all the tables in the schema.

dbLINK_FIELDS
returns a pointer to an Arr, the keys of which are the names of all the Link fields, and the corresponding values are the names of the tables which define the fields.

dbUNIQUE_ID_NAME
returns the field name for a single integer id key for the specified table, if such a key exists. When such a key exists (e.g., arid in the arrival table for css3.0), it is required to be unique in the table.

dbTABLE_PRESENT
returns a flag which is non-zero if the specified table has one or more records.

dbTABLE_IS_VIEW
returns a flag which is non-zero if the specified table is a view, rather than a primary table. Note that the result from dbgroup is not labeled as a view, because its records are not simply a list of references (database pointers) to base tables. Instead, it contains explicit fields (the fields specified in the call to dbgroup), as well as bundletype, and bundle. bundle is a special range dbptr. The distinction is important because while intermediate views can be freed if they're no longer required, grouped views -- like base tables -- must be retained until all dependent views are freed.

dbTABLE_IS_WRITABLE
returns a flag which is non-zero if the specified table may be written to.

dbTABLE_IS_ADDABLE
returns a flag which is non-zero if locks (and permissions) allow adding rows to the specified table. For instance, it's not possible to add rows to an nfs mounted table when DBLOCKS is "yes".

dbDATABASE_IS_WRITABLE
returns a flag which is non-zero if the specified database was opened with write permissions.

dbTABLE_ADDRESS
returns the address in memory of a database table; this is primarily for use in copy operations, and should be avoided generally, as it may be non-portable.

dbFIELD_BASE_TABLE
returns the name of the base table in which the selected field is found.

dbTABLE_IS_TRANSIENT
returns 1 if the selected table is a transient table with no filesystem representation.

dbTIMEDATE_NAME
returns name of timedate field if one is defined in the schema.

dbLASTIDS
returns array of lastid by table name

dbIDSERVER
returns name of idserver if defined in descriptor file, otherwise 0

dbLOCKS
returns setting of dbLOCKS

SEE ALSO

dbquery(3) dbintro(3)

AUTHOR

Daniel Quinlan
Printer icon