quiverdb 0.13.4 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -151,7 +151,7 @@ bun run example.ts
151
151
  - `readTimeSeriesFiles(collection)` -- Read the file paths (`null` for an unset column)
152
152
  - `updateTimeSeriesFiles(collection, data)` -- Write the file paths
153
153
 
154
- ### Query
154
+ ### Query (read-only SQL)
155
155
 
156
156
  - `queryString(sql, parameters?)` -- Query returning string or null
157
157
  - `queryInteger(sql, parameters?)` -- Query returning integer or null
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quiverdb",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -116,6 +116,13 @@ midnight.
116
116
  (subdirectories are fine; \`..\` escapes and outside absolute paths throw \`Cannot <op>: path '...' escapes the
117
117
  database directory ...\`). On an in-memory database these operations throw
118
118
  \`Cannot <op>: database is in-memory, file operations are unavailable\`.
119
+ - **Raw SQL is read-only.** \`db:query_string\` / \`db:query_integer\` / \`db:query_float\` accept only
120
+ statements that read: a write (\`INSERT\`, \`UPDATE\`, \`DELETE\`, DDL), a \`PRAGMA\` statement,
121
+ \`ATTACH\`/\`DETACH\`, \`VACUUM\` or transaction control (\`BEGIN\`, \`COMMIT\`, \`ROLLBACK\`,
122
+ \`SAVEPOINT\`) throws \`Cannot query: SQL must be read-only; writes, PRAGMA, ATTACH, VACUUM and
123
+ transaction control are not allowed\` before anything runs. The table-valued \`pragma_*()\`
124
+ functions (\`SELECT name FROM pragma_table_info('X')\`) are reads and stay available. Write
125
+ through the \`db:\` API, which validates what it writes.
119
126
  - **What the sandbox does not limit.** The sandbox controls which files a script can touch and
120
127
  which standard libraries exist. It does not bound how much work a script does: there is no
121
128
  instruction-count limit, no memory cap and no wall-clock timeout (\`while true do end\` runs
@@ -624,9 +631,10 @@ entirely.
624
631
 
625
632
  ---
626
633
 
627
- ## Query (parameterized SQL)
634
+ ## Query (parameterized, read-only SQL)
628
635
 
629
- Positional \`?\` placeholders; \`params\` is an optional 1-indexed array. Each returns the first
636
+ Only statements that read are accepted (see "Raw SQL is read-only" above); anything else throws
637
+ before it runs. Positional \`?\` placeholders; \`params\` is an optional 1-indexed array. Each returns the first
630
638
  column of the first row, or \`nil\` when there is no row, the value is NULL, or it is not already
631
639
  the requested type. Only \`query_float\` converts (it widens an INTEGER), so
632
640
  \`db:query_string("SELECT COUNT(*) ...")\` and \`db:query_integer("SELECT AVG(x) ...")\` return
@@ -1024,6 +1032,7 @@ value of the wrong type throws.
1024
1032
  DateTime wrapper helpers (Lua uses ISO 8601 strings), boolean *reader* helpers (a stored flag reads
1025
1033
  back as \`0\`/\`1\` — writing a boolean is supported), \`_by_id\` single-scalar variants (use the
1026
1034
  composite by-id readers or the bulk readers instead), and the row-aligned whole-group readers the
1027
- other bindings have (hence the row-count caveat under composite by-id reads). Everything else
1028
- the native binding exposes — CRUD, reads, time series, metadata, query, CSV, and the
1029
- binary/expression subsystems — is documented above and callable.`;
1035
+ other bindings have (hence the row-count caveat under composite by-id reads). Raw SQL that writes,
1036
+ sets a \`PRAGMA\`, attaches a database, vacuums or controls a transaction (\`query_*\` is read-only
1037
+ in every binding). Everything else the native binding exposes — CRUD, reads, time series,
1038
+ metadata, query, CSV, and the binary/expression subsystems — is documented above and callable.`;