Created
May 20, 2023 00:17
-
-
Save UplinkCoder/3c9afc72465ea120402077255fab8184 to your computer and use it in GitHub Desktop.
metac.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Table: Fields | |
CREATE TABLE IF NOT EXISTS Fields ( | |
StructIndex INTEGER PRIMARY KEY NOT NULL, | |
FieldIndex INTEGER, | |
Identifier INTEGER, | |
TypeIndex INTEGER, | |
Offset INTEGER, | |
FOREIGN KEY (Identifier) REFERENCES Identifiers (Index), | |
FOREIGN KEY (TypeIndex) REFERENCES Types (Index) | |
); | |
-- Table: Files | |
CREATE TABLE IF NOT EXISTS Files ( | |
FileName TEXT NOT NULL, | |
FullPath TEXT NOT NULL, | |
FileHash INTEGER UNSIGNED NOT NULL, | |
LexerHash INTEGER UNSIGNED NOT NULL, | |
Content TEXT NOT NULL | |
); | |
-- Table: Identifiers | |
CREATE TABLE IF NOT EXISTS Identifiers ( | |
Name TEXT, | |
Hash INTEGER NOT NULL, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT | |
); | |
-- Table: Locations | |
CREATE TABLE IF NOT EXISTS Locations ( | |
FullPath TEXT, | |
StartLine INTEGER, | |
StartCol INTEGER, | |
LineSpan INTEGER, | |
EndCol INTEGER, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT | |
); | |
-- Table: Strings | |
CREATE TABLE IF NOT EXISTS Strings ( | |
String TEXT, | |
Hash INTEGER NOT NULL, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT | |
); | |
-- Table: Structs | |
CREATE TABLE IF NOT EXISTS Structs ( | |
Name INTEGER, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT | |
); | |
-- Insert data for table Structs | |
INSERT INTO Structs (Name) VALUES (2), (1); | |
-- Table: Types | |
CREATE TABLE IF NOT EXISTS Types ( | |
Kind INTEGER NOT NULL, | |
ElementIndex INTEGER, | |
Name TEXT, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT | |
); | |
-- Insert data for table Types | |
INSERT INTO Types (Kind, ElementIndex, Name) VALUES (1, 1, 'void'), (1, 2, 'char'), (1, 3, 'short'), (1, 4, 'int'); | |
-- Table: Variables | |
CREATE TABLE IF NOT EXISTS Variables ( | |
TypeKind INTEGER NOT NULL, | |
TypeIndex INTEGER NOT NULL, | |
Name INTEGER NOT NULL, | |
SourceLocationIndex INTEGER, | |
StorageLocationIndex INTEGER, | |
Index INTEGER PRIMARY KEY AUTOINCREMENT, | |
FOREIGN KEY (Name) REFERENCES Identifiers (Index) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment