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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
From 96042887815b4700c7cafa64cf88942af438ea98 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Fri, 24 Feb 2023 13:38:56 +0100
Subject: [PATCH] build: fix awk scripts to work properly when used againts
sqlite 3.41.0
The SQL standard requires double-quotes around identifiers and
single-quotes around string literals. For example:
"this is a legal SQL column name"
'this is an SQL string literal'
With sqlite 3.41.0, this is being enforced on the CLI
---
data/english.awk | 8 ++++----
data/table.awk | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/data/english.awk b/data/english.awk
index c5dc0aa2..8b32f3f2 100644
--- a/data/english.awk
+++ b/data/english.awk
@@ -5,9 +5,9 @@ BEGIN {
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)" \
+ print "CREATE TABLE IF NOT EXISTS 'english' ( " \
+ "'word' TEXT NOT NULL PRIMARY KEY," \
+ "'freq' FLOAT NOT NULL DEFAULT(0)" \
");";
# Create desc table
@@ -16,7 +16,7 @@ BEGIN {
}
# Insert data into english table
- { printf "INSERT INTO english (word, freq) VALUES (\"%s\", %f);\n", $1, $2}
+ { printf "INSERT INTO english (word, freq) VALUES ('%s', %f);\n", $1, $2}
#quit sqlite3
END {
diff --git a/data/table.awk b/data/table.awk
index 700529cf..c097ec26 100644
--- a/data/table.awk
+++ b/data/table.awk
@@ -21,7 +21,7 @@ BEGIN {
# Insert data into phrases table
NF == 4 {
- printf "INSERT INTO phrases (id, tabkeys, phrase) VALUES (%d, \"%s\", \"%s\");\n", id, $3, $1;
+ printf "INSERT INTO phrases (id, tabkeys, phrase) VALUES (%d, '%s', '%s');\n", id, $3, $1;
id++;
}
|