summaryrefslogtreecommitdiff
path: root/data/english.awk
blob: 1828d2c7fde0be5ed9de0eb5a7d9af1a85789120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/awk

BEGIN {
    # Begin a transaction
    print "BEGIN TRANSACTION;"

    # Create english table
    print "CREATE TABLE IF NOT EXISTS \"english\" ( "   \
        "\"word\" TEXT NOT NULL PRIMARY KEY,"                       \
        "\"freq\" FLOAT NOT NULL DEFAULT(0)"            \
        ");";

    # Create desc table
    print "CREATE TABLE IF NOT EXISTS desc (name TEXT PRIMARY KEY, value TEXT);";
    print "INSERT OR IGNORE INTO desc VALUES ('version', '1.2.0');";
}

    # Insert data into english table
    {   printf "INSERT INTO english (word, freq) VALUES (\"%s\", \"%f\");\n", $1, $2}

    #quit sqlite3
END {
    # Commit the transcation
    print "COMMIT;"
}