summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-06-07 15:10:52 -0400
committerLouie S <louie@example.com>2024-06-07 15:10:52 -0400
commit603d3105cb16470e502f0e3d20f95d2243771e33 (patch)
tree2d775cf0fd4df3e745ff1649d5e1119e13416113 /src
parenta9413e16e8a8d160acb760a0971f25ef23d71e8c (diff)
Replace placeholders with wildcard rules
Diffstat (limited to 'src')
-rw-r--r--src/scripts/create_table.sh7
-rw-r--r--src/scripts/insert.sh8
2 files changed, 15 insertions, 0 deletions
diff --git a/src/scripts/create_table.sh b/src/scripts/create_table.sh
new file mode 100644
index 0000000..a783c50
--- /dev/null
+++ b/src/scripts/create_table.sh
@@ -0,0 +1,7 @@
+create_table() {
+ DB_PATH="$1"
+
+ sqlite3 "$DB_PATH" "CREATE TABLE IF NOT EXISTS searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);"
+ sqlite3 "$DB_PATH" "CREATE UNIQUE INDEX IF NOT EXISTS anchor ON searchIndex (name, type, path);"
+}
+
diff --git a/src/scripts/insert.sh b/src/scripts/insert.sh
new file mode 100644
index 0000000..31c1b4c
--- /dev/null
+++ b/src/scripts/insert.sh
@@ -0,0 +1,8 @@
+insert() {
+ DB_PATH="$1"
+ NAME="$2"
+ TYPE="$3"
+ PAGE_PATH="$4"
+
+ sqlite3 "$DB_PATH" "INSERT INTO searchIndex(name, type, path) VALUES (\"$NAME\",\"$TYPE\",\"$PAGE_PATH\");"
+}