aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-07-26 19:11:52 -0500
committerAnthony Wang2024-07-26 19:11:52 -0500
commite0ea4329dc01c810ab10a967aea6ef551e27f693 (patch)
tree4f869b4df8062a41fbdc62a40130b404b51ddbe1
parent85dc148d6cea1fbd1c1444bec0fd2851a5ddf826 (diff)
Use TEXT instead of STRING for kv types
-rw-r--r--README.md4
-rwxr-xr-xtest.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/README.md b/README.md
index 675b454..9144fb1 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,9 @@ This is a C port of [SD](https://git.exozy.me/a/SD), a very efficient (and a tin
## Usage
-Flash cards are stored in the `cards` table of a SQLite database. There are four columns: `idx INTEGER PRIMARY KEY, weight INTEGER, key STRING, val STRING`. The `idx` is a unique index for each card, starting at 0. The weight is how often the card should come up. The key and value are the front and reverse sides of the card.
+Flash cards are stored in the `cards` table of a SQLite database. There are four columns: `idx INTEGER PRIMARY KEY, weight INTEGER, key TEXT, val TEXT`. The `idx` is a unique index for each card, starting at 0. The weight is how often the card should come up. The key and value are the front and reverse sides of the card.
-To create a card deck, use `sqlite3 cards "CREATE TABLE cards (idx INTEGER PRIMARY KEY, weight INTEGER, key STRING, val STRING)`. You may be able to double the performance by enabling WAL with `PRAGMA journal_mode=WAL`, because WAL only writes the content once instead of twice.
+To create a card deck, use `sqlite3 cards "CREATE TABLE cards (idx INTEGER PRIMARY KEY, weight INTEGER, key TEXT, val TEXT)`. You may be able to double the performance by enabling WAL with `PRAGMA journal_mode=WAL`, because WAL only writes the content once instead of twice.
Now build SDC with `gcc sd.c segmenttree.c -o sd -lsqlite3 -O2 -march=native` and run `./sd` to enjoy a fast flash cards experience! You can also install the `sdc-git` package from the [AUR](https://aur.archlinux.org/packages/sdc-git). The program will display the `key` of a randomly selected card. Press any key to show the `val` of the card. Now press either `y` or `n` depending on whether you got the card correct, and the program adjusts that card's weight.
diff --git a/test.py b/test.py
index 84c230b..44333c6 100755
--- a/test.py
+++ b/test.py
@@ -5,7 +5,7 @@ import sqlite3
con = sqlite3.connect("test.db")
con.execute("PRAGMA journal_mode=wal")
cur = con.cursor()
-cur.execute("CREATE TABLE cards (idx INTEGER PRIMARY KEY, weight INTEGER, key STRING, val STRING)")
+cur.execute("CREATE TABLE cards (idx INTEGER PRIMARY KEY, weight INTEGER, key TEXT, val TEXT)")
for i in range(10**8):
cur.execute("INSERT INTO cards VALUES(?, ?, ?, ?)", (i, 1, i, i))
con.commit()