# Schema of the Generated Database

The following sections describe the schema of the database created through the SQL backend.

## Table IDS

Details of interdependant identifiers appearing in the workspace.

Field name | Field type | Value description
--- | --- | ---
EID | INTEGER or BIGINT1 | Unique identifier key
NAME | CHARACTER VARYING | Identifier name
READONLY | BOOLEAN | True if it appears in at least one read-only file
UNDEFMACRO | BOOLEAN | True if it is apparantly an undefined macro
MACRO | BOOLEAN | True if it a preprocessor macro
MACROARG | BOOLEAN | True if it a preprocessor macro argument
ORDINARY | BOOLEAN | True if it is an ordinary identifier (variable or function)
SUETAG | BOOLEAN | True if it is a structure, union, or enumeration tag
SUMEMBER | BOOLEAN | True if it is a structure or union member
LABEL | BOOLEAN | True if it is a label
TYPEDEF | BOOLEAN | True if it is a typedef
ENUM | BOOLEAN | True if it is an enumeration member
YACC | BOOLEAN | True if it is a yacc identifier
FUN | BOOLEAN | True if it is a function name
CSCOPE | BOOLEAN | True if its scope is a compilation unit
LSCOPE | BOOLEAN | True if it has linkage scope
UNUSED | BOOLEAN | True if it is not used

## Table FILES

File details.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | Unique file key
NAME | CHARACTER VARYING | File name
RO | BOOLEAN | True if the file is read-only
NCHAR | INTEGER | Number of characters
NCCOMMENT | INTEGER | Number of comment characters
NSPACE | INTEGER | Number of space characters
NLCOMMENT | INTEGER | Number of line comments
NBCOMMENT | INTEGER | Number of block comments
NLINE | INTEGER | Number of lines
MAXLINELEN | INTEGER | Maximum number of characters in a line
NSTRING | INTEGER | Number of character strings
NULINE | INTEGER | Number of unprocessed lines
NPPTOKEN | INTEGER | Number of preprocessed tokens
NCTOKEN | INTEGER | Number of compiled tokens
NPPDIRECTIVE | INTEGER | Number of C preprocessor directives
NPPCOND | INTEGER | Number of processed C preprocessor conditionals (ifdef, if, elif)
NPPFMACRO | INTEGER | Number of defined C preprocessor function-like macros
NPPOMACRO | INTEGER | Number of defined C preprocessor object-like macros
NSTATEMENT | INTEGER | Number of statements
NCOPIES | INTEGER | Number of copies of the file
NPFUNCTION | INTEGER | Number of defined project-scope functions
NFFUNCTION | INTEGER | Number of defined file-scope (static) functions
NPVAR | INTEGER | Number of defined project-scope variables
NFVAR | INTEGER | Number of defined file-scope (static) variables
NAGGREGATE | INTEGER | Number of complete aggregate (struct/union) declarations
NAMEMBER | INTEGER | Number of declared aggregate (struct/union) members
NENUM | INTEGER | Number of complete enumeration declarations
NEMEMBER | INTEGER | Number of declared enumeration elements
NINCFILE | INTEGER | Number of directly included files

## Table TOKENS

Instances of identifier tokens within the source code.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
FOFFSET | INTEGER | Offset within the file
EID | INTEGER or BIGINT1 | Identifier key (references IDS)

## Table COMMENTS

Comments in the code.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
FOFFSET | INTEGER | Offset within the file
COMMENT | CHARACTER VARYING | The comment, including its delimiters

## Table STRINGS

Strings in the code.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
FOFFSET | INTEGER | Offset within the file
STRING | CHARACTER VARYING | The string, including its delimiters

## Table REST

Remaining, non-identifier source code.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
FOFFSET | INTEGER | Offset within the file
CODE | CHARACTER VARYING | The actual code

## Table LINEPOS

Line number offsets within each file.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
FOFFSET | INTEGER | Offset within the file
LNUM | INTEGER | Line number (starts at 1)

## Table PROJECTS

Project details.

Field name | Field type | Value description
--- | --- | ---
PID | INTEGER | Unique project key
NAME | CHARACTER VARYING | Project name

## Table IDPROJ

Identifiers appearing in projects.

Field name | Field type | Value description
--- | --- | ---
EID | INTEGER or BIGINT1 | Identifier key (references IDS)
PID | INTEGER | Project key (references PROJECTS)

## Table FILEPROJ

Files used in projects.

Field name | Field type | Value description
--- | --- | ---
FID | INTEGER | File key (references FILES)
PID | INTEGER | Project key (references PROJECTS)

## Table DEFINERS

Included files defining required elements for a given compilation unit and project.

Field name | Field type | Value description
--- | --- | ---
PID | INTEGER | Project key (references PROJECTS)
CUID | INTEGER | Compilation unit key (references FILES)
BASEFILEID | INTEGER | File (often .c) requiring (using) a definition (references FILES)
DEFINERID | INTEGER | File (often .h) providing a definition (references FILES)

## Table INCLUDERS

Included files including files for a given compilation unit and project.

Field name | Field type | Value description
--- | --- | ---
PID | INTEGER | Project key (references PROJECTS)
CUID | INTEGER | Compilation unit key (references FILES)
BASEFILEID | INTEGER | File included in the compilation (references FILES)
INCLUDERID | INTEGER | Files that include it (references FILES)

## Table PROVIDERS

Included files providing code or data for a given compilation unit and project.

Field name | Field type | Value description
--- | --- | ---
PID | INTEGER | Project key (references PROJECTS)
CUID | INTEGER | Compilation unit key (references FILES)
PROVIDERID | INTEGER | Included file (references FILES)

## Table INCTRIGGERS

Tokens requiring file inclusion for a given compilation unit and project.

Field name | Field type | Value description
--- | --- | ---
PID | INTEGER | Project key (references PROJECTS)
CUID | INTEGER | Compilation unit key (references FILES)
BASEFILEID | INTEGER | File requiring a definition (references FILES)
DEFINERID | INTEGER | File providing a definition (references FILES)
FOFFSET | INTEGER | Definition's offset within the providing file
LEN | INTEGER | Token's length

## Table FUNCTIONS

C functions and function-like macros.

Field name | Field type | Value description
--- | --- | ---
ID | INTEGER or BIGINT1 | Unique function identifier
NAME | CHARACTER VARYING | Function name (redundant; see FUNCTIONID)
ISMACRO | BOOLEAN | True if a function-like macro (otherwise a C function)
DEFINED | BOOLEAN | True if the function is defined within the workspace
DECLARED | BOOLEAN | True if the function is declared within the workspace
FILESCOPED | BOOLEAN | True if the function's scope is a single compilation unit (static or macro)
FID | INTEGER | File key of the function's definition, declaration, or use (references FILES)
FOFFSET | INTEGER | Offset of definition, declaration, or use within the file
FANIN | INTEGER | Fan-in (number of callers)

## Table FUNCTIONMETRICS

Metrics of defined functions and macros.

Field name | Field type | Value description
--- | --- | ---
FUNCTIONID | INTEGER or BIGINT1 | Function identifier key (references FUNCTIONS)
NCHAR | INTEGER | Number of characters
NCCOMMENT | INTEGER | Number of comment characters
NSPACE | INTEGER | Number of space characters
NLCOMMENT | INTEGER | Number of line comments
NBCOMMENT | INTEGER | Number of block comments
NLINE | INTEGER | Number of lines
MAXLINELEN | INTEGER | Maximum number of characters in a line
NSTRING | INTEGER | Number of character strings
NULINE | INTEGER | Number of unprocessed lines
NPPTOKEN | INTEGER | Number of preprocessed tokens
NCTOKEN | INTEGER | Number of compiled tokens
NPPDIRECTIVE | INTEGER | Number of C preprocessor directives
NPPCOND | INTEGER | Number of processed C preprocessor conditionals (ifdef, if, elif)
NPPFMACRO | INTEGER | Number of defined C preprocessor function-like macros
NPPOMACRO | INTEGER | Number of defined C preprocessor object-like macros
NSTMT | INTEGER | Number of statements or declarations
NOP | INTEGER | Number of operators
NUOP | INTEGER | Number of unique operators
NNCONST | INTEGER | Number of numeric constants
NCLIT | INTEGER | Number of character literals
NIF | INTEGER | Number of if statements
NELSE | INTEGER | Number of else clauses
NSWITCH | INTEGER | Number of switch statements
NCASE | INTEGER | Number of case labels
NDEFAULT | INTEGER | Number of default labels
NBREAK | INTEGER | Number of break statements
NFOR | INTEGER | Number of for statements
NWHILE | INTEGER | Number of while statements
NDO | INTEGER | Number of do statements
NCONTINUE | INTEGER | Number of continue statements
NGOTO | INTEGER | Number of goto statements
NRETURN | INTEGER | Number of return statements
NPID | INTEGER | Number of project-scope identifiers
NFID | INTEGER | Number of file-scope (static) identifiers
NMID | INTEGER | Number of macro identifiers
NID | INTEGER | Total number of object and object-like identifiers
NUPID | INTEGER | Number of unique project-scope identifiers
NUFID | INTEGER | Number of unique file-scope (static) identifiers
NUMID | INTEGER | Number of unique macro identifiers
NUID | INTEGER | Number of unique object and object-like identifiers
NGNSOC | INTEGER | Number of global namespace occupants at function's top
NPARAM | INTEGER | Number of parameters
MAXNEST | INTEGER | Maximum level of statement nesting
NLABEL | INTEGER | Number of goto labels
FANIN | INTEGER | Fan-in (number of calling functions)
FANOUT | INTEGER | Fan-out (number of called functions)
CCYCL1 | INTEGER | Cyclomatic complexity (control statements)
CCYCL2 | INTEGER | Extended cyclomatic complexity (includes branching operators)
CCYCL3 | INTEGER | Maximum cyclomatic complexity (includes branching operators and all switch branches)
CSTRUC | REAL | Structure complexity (Henry and Kafura)
CHAL | REAL | Halstead complexity
IFLOW | REAL | Information flow metric (Henry and Selig)
FIDBEGIN | INTEGER | File key of the function's definition begin (references FILES)
FOFFSETBEGIN | INTEGER | Offset of definition begin within the file
FIDEND | INTEGER | File key of the function's definition end (references FILES)
FOFFSETEND | INTEGER | Offset of definition end within the file

## Table FUNCTIONID

Identifiers comprising a function's name.

Field name | Field type | Value description
--- | --- | ---
FUNCTIONID | INTEGER or BIGINT1 | Function identifier key (references FUNCTIONS)
ORDINAL | INTEGER | Position of the identifier within the function name (0-based)
EID | INTEGER or BIGINT1 | Identifier key (references IDS)

## Table FCALLS

Function calls.

Field name | Field type | Value description
--- | --- | ---
SOURCEID | INTEGER or BIGINT1 | Calling function identifier key (references FUNCTIONS)
DESTID | INTEGER or BIGINT1 | Called function identifier key (references FUNCTIONS)

## Table FILECOPIES

Files occuring in more than one copy.

Field name | Field type | Value description
--- | --- | ---
GROUPID | INTEGER | File group identifier
FID | INTEGER | Key of file belonging to a group of identical files (references FILES)

Note 1: INTEGER on 32-bit architectures, BIGINT on 64-bit archiectures.

Contents | « Previous Next (Examples of SQL Queries) »