From 49bc31720ab6206980cda95a0a30a44e7f882fcc Mon Sep 17 00:00:00 2001
From: Akshay Nair <phenax5@gmail.com>
Date: Tue, 2 Jun 2026 21:28:39 +0530
Subject: Clean up the c stuff and switch to simple bash + add example

---
 examples/circle.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 examples/circle.sql

(limited to 'examples/circle.sql')

diff --git a/examples/circle.sql b/examples/circle.sql
new file mode 100644
index 0000000..73e7118
--- /dev/null
+++ b/examples/circle.sql
@@ -0,0 +1,25 @@
+CREATE TEMP TABLE variables(name TEXT PRIMARY KEY, value Text);
+
+INSERT INTO images (width, height) VALUES (6, 6) RETURNING id;
+INSERT INTO variables VALUES ('image_id', last_insert_rowid());
+
+WITH RECURSIVE
+  image_id AS (SELECT value FROM variables WHERE name = 'image_id'),
+  horizontal(x) AS (
+    SELECT width FROM images WHERE id = (SELECT * FROM image_id)
+    UNION ALL
+    SELECT x - 1 FROM horizontal
+    WHERE x > 1
+  ),
+  vertical(y) AS (
+    SELECT height FROM images WHERE id = (SELECT * FROM image_id)
+    UNION ALL
+    SELECT y - 1 FROM vertical
+    WHERE y > 1
+  ),
+  pixels_temp(x, y, r, g, b) AS (
+    SELECT x, y, 255, 0, 0 FROM vertical, horizontal
+  )
+INSERT INTO pixels (image_id, x, y, r, g, b) SELECT (SELECT * FROM image_id), x, y, r, g, b FROM pixels_temp;
+
+DROP TABLE variables;
-- 
cgit v1.3.1

