Automation Example: C++ Code

void
workdb_schema(Sql *db, ostream &of)
{
    cout <<
        // BEGIN AUTOSCHEMA
        "CREATE TABLE STRINGS("         // Strings in the code
        "FID INTEGER,"                  // File key (references FILES)
        "FOFFSET INTEGER,"              // Offset within the file
        "STRING " << db->varchar() << ","   // The string, including its delimiters
        "PRIMARY KEY(FID, FOFFSET)"
        ");\n"

        "CREATE TABLE LINEPOS("         // Line number offsets within each file
        "FID INTEGER,"                  // File key (references FILES)
        "FOFFSET INTEGER,"              // Offset within the file
        "LNUM INTEGER,"                 // Line number (starts at 1)
        "PRIMARY KEY(FID, FOFFSET)"
        ");\n"

        "CREATE TABLE FCALLS("          // Function calls
        "SOURCEID INTEGER, "            // Calling function identifier key (references FUNCTIONS)
        "DESTID INTEGER"                // Called function identifier key (references FUNCTIONS)
        ");\n"
        // ...
        // END AUTOSCHEMA
        "";
}