simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 2df5315bdbd11a0926e069605c4395c8a831bac6
parent efcefa3f48e143404cc1111b4510f81b89d97535
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sun, 14 Jun 2026 15:41:48 +0200

fix: write seed SQL to temp file to avoid arg length limit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Mbench.sh | 28++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/bench.sh b/bench.sh @@ -34,19 +34,23 @@ COMMENTS_PER_STORY=${COMMENTS_PER_STORY:-5} COMMENT_STORIES=20 echo "Seeding $STORIES stories, $((COMMENT_STORIES * COMMENTS_PER_STORY)) comments..." -$SQLITE $DB_PATH " -BEGIN; -$(for i in $(seq 1 $STORIES); do - echo "INSERT INTO story (title, url, text, domain, published, language, created_by, score) VALUES ('Story $i about interesting things', 'https://example.com/$i', 'Body text for story $i with words for FTS.', 'example.com', $(date +%s), 'en', 1, $((RANDOM % 50)));" -done) -$(for s in $(seq 1 $COMMENT_STORIES); do - for c in $(seq 1 $COMMENTS_PER_STORY); do - echo "INSERT INTO comment (story_id, parent_id, path, depth, text, created_by, created_at) VALUES ($s, NULL, '$c', 0, 'Comment $c on story $s with discussion text', 1, $(date +%s));" +SEED_FILE=$(mktemp) +{ + echo "BEGIN;" + NOW=$(date +%s) + for i in $(seq 1 $STORIES); do + echo "INSERT INTO story (title, url, text, domain, published, language, created_by, score) VALUES ('Story $i about interesting things', 'https://example.com/$i', 'Body text for story $i with words for FTS.', 'example.com', $NOW, 'en', 1, $((RANDOM % 50)));" done -done) -COMMIT; -INSERT INTO story_fts(story_fts) VALUES('rebuild'); -" + for s in $(seq 1 $COMMENT_STORIES); do + for c in $(seq 1 $COMMENTS_PER_STORY); do + echo "INSERT INTO comment (story_id, parent_id, path, depth, text, created_by, created_at) VALUES ($s, NULL, '$c', 0, 'Comment $c on story $s with discussion text', 1, $NOW);" + done + done + echo "COMMIT;" + echo "INSERT INTO story_fts(story_fts) VALUES('rebuild');" +} > "$SEED_FILE" +$SQLITE $DB_PATH < "$SEED_FILE" +rm "$SEED_FILE" echo "" echo "=== Data ==="