SQLite support
grimnight opened this issue · 2 comments
grimnight commented
Hi,
I tried writing a simple sqlite script:
; sqlite test
rye .needs { sqlite }
db: open sqlite://test.db
exec db { create table test ( key text , value text ) }
exec db { insert into test values ( "key1" , "value1" ) }
exec db { insert into test values ( "key2" , "value2" ) }
query db { select * from test } |print
but all I get is:
~/Dev/GHQ/github.com/refaktor
❯ ryelang sqlite-test.rye
panic: interface conversion: env.Object is *env.String, not env.String
goroutine 1 [running]:
github.com/refaktor/rye/evaldo.SQL_EvalExpression(0xc0001de000, {0x112cba0, 0x0, 0x0}, 0x7f4fe8150238?)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/builtins_sqlite.go:66 +0x67d
github.com/refaktor/rye/evaldo.SQL_EvalBlock(0x0?, 0x1, {0x112cba0?, 0x0?, 0xc0002f6a90?})
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/builtins_sqlite.go:27 +0xde
github.com/refaktor/rye/evaldo.init.func466(0xc0001de000, {0xc99080, 0xc000305cc8}, {0xc98d60?, 0xc0002fb560?}, {0x0?, 0x0?}, {0x0?, 0x0?}, {0x0, ...})
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/builtins_sqlite.go:138 +0x176
github.com/refaktor/rye/evaldo.CallBuiltin({0xbe3f48, 0x2, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:1039 +0xfff
github.com/refaktor/rye/evaldo.EvalObject(0xc0001de000, {0xc99170, 0xc0001fd100}, {0xc99080, 0xc000305cc8}, 0x0, 0x0, 0x0, {0x0, 0x0})
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:551 +0x190
github.com/refaktor/rye/evaldo.EvalWord(0xc0001de000, {0xc98b30, 0xc000015580}, {0x0, 0x0}, 0x0, 0x0)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:496 +0x3a6
github.com/refaktor/rye/evaldo.EvalExpressionConcrete(0xc0001de000)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:386 +0x206
github.com/refaktor/rye/evaldo.EvalExpressionInj(0xc0001de000, {0x0?, 0x0?}, 0x0)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:191 +0x68
github.com/refaktor/rye/evaldo.EvalBlockInj(0x41b125?, {0x0, 0x0}, 0x70?)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:96 +0x4f
github.com/refaktor/rye/evaldo.EvalBlock(0xc0001da120?)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/evaldo/evaldo.go:54 +0x37
github.com/refaktor/rye/runner.main_rye_file({0x7ffcffb6f884, 0x13}, 0x0, 0x1, 0x0, {0x0, 0x0}, 0xbe2eb0)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/runner/runner.go:388 +0x547
github.com/refaktor/rye/runner.DoMain(0xbe2eb0)
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/runner/runner.go:108 +0x27f
main.main()
/home/grimnight/Dev/GHQ/github.com/refaktor/rye/main.go:36 +0x1a
Is sqlite not supported yet, or am I doing something wrong?
refaktor commented
Hi. Thank you for the Issue. SQLite (and postgres and mysql) were all done years ago and should work. I haven't been using or testing them for a while, so we probably broke something with further changes to the language. I will test it and fix it. Thanks!
refaktor commented
@grimnight thanks for reporting the problem. It got fixed.
rye --do 'open sqlite://test.db /query { select * from test } /display'
| key | value |
+-------------------+
| key1 | value1 |
| key2 | value2 |