如何使用红色连接到sqlite3

How to connect to sqlite3 with red

我已经尝试加载红色网站上提到的两个 sqlite 库,但是它们都是基于 rebol 的,并且会出现 "invalid issue" 错误,例如:

*** Syntax Error: invalid issue! at "^-^-^-#[datatype! integer!]^-[*bind-int (sid"
*** Where: do
*** Stack: do-file expand-directives load

想从 sqlite 存储中获取数据并从 red 更新相同的数据。

编辑:我已经设法使用 call/output 来调用 sqlite3 可执行文件,但不知道是否有更好的方法来做到这一点。

files: ""
call/output {sqlite3 test.sqlite "select bookid, title from books order by rowid desc limit 10"} files
rows: split files "^/"

每一行都需要拆分。

在你的例子中,解释器被所谓的构造语法#[...]噎住,目前只有部分红色支持。

此外,SQLite3 绑定(和任何 I/O-oriented 库)的使用需要 port! 数据类型实现,这只会在 0.7.0 版本中出现。与此同时,call 应该可以很好地满足您的需求,即使它看起来像是一个临时解决方案。