src/sql/queries

Consts

sqlGetAllDefinitions: string = "SELECT * FROM definitions;"
sqlGetDefinitionById: string = "SELECT * FROM definitions WHERE id IS ?;"
sqlGetDefinitionsByName: string = "SELECT * FROM definitions WHERE word LIKE ?;"
sqlGetEntriesByHash: string = "-- This file name is stupid, but descriptive... I guess...\nSELECT * FROM definitions WHERE sha3hash IS ?;"
sqlInitTableDefinitions: string = "-- Main table with definitions:\nCREATE TABLE IF NOT EXISTS definitions (\n    id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL DEFAULT 0,\n    word TEXT NOT NULL,\n    description TEXT NOT NULL,\n    author TEXT DEFAULT \'Anonymous\',\n    upvotes INTEGER DEFAULT 0,\n    downvotes INTEGER DEFAULT 0,\n    timestamp INTEGER DEFAULT CURRENT_TIMESTAMP,\n    sha3hash TEXT\n);"
sqlInitTables: array[1, string] = ["-- Main table with definitions:\nCREATE TABLE IF NOT EXISTS definitions (\n    id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL DEFAULT 0,\n    word TEXT NOT NULL,\n    description TEXT NOT NULL,\n    author TEXT DEFAULT \'Anonymous\',\n    upvotes INTEGER DEFAULT 0,\n    downvotes INTEGER DEFAULT 0,\n    timestamp INTEGER DEFAULT CURRENT_TIMESTAMP,\n    sha3hash TEXT\n);"]
sqlNewEntry: string = "INSERT INTO definitions (word, description, author, sha3hash) VALUES (?, ?, ?, ?);"
sqlNewEntryAnonymous: string = "INSERT INTO definitions (word, description, sha3hash) VALUES (?, ?, ?);"
sqlNewEntryHash: string = "INSERT INTO hashes (hash) VALUES (?);"