nim-ladybug/tests/queries/t_can_bind_to_a_prepared_statement.nim

26 lines
625 B
Nim
Raw Permalink Normal View History

# vim: set et sta sw=4 ts=4 :
discard """
output: "d.thing\nCamel\nLampshade\nDelicious Cake\n"
"""
import lbug
let db = newLbugDatabase()
let conn = db.connect
var q = conn.query( "CREATE NODE TABLE Doop ( id SERIAL, thing STRING, PRIMARY KEY(id) )" )
var p = conn.prepare( "CREATE (d:Doop {thing: $thing})" )
assert typeOf( p ) is LbugPreparedStatement
for thing in @[ "Camel", "Lampshade", "Delicious Cake" ]:
q = p.execute( (thing: thing) )
assert typeOf( q ) is LbugQueryResult
# Fixed post v0.8.2:
# https://github.com/kuzudb/kuzu/issues/5102
q = conn.query( "MATCH (d:Doop) RETURN d.thing" )
echo $q