execute command or block of commands in given database and get returned rows
Parameters
query database :database
commands :string :block
Attributes
id
return last INSERT id
with
:block
use arguments for parametrized statement
Returns
:null
:integer
:block
Examples
copy
db: open "my.db" ; opens an SQLite database named 'my.db'
; perform a simple query
print query db "SELECT * FROM users"
; perform an INSERT query and get back the record's ID
username: "johndoe"
lastInsertId: query.id db ~{!sql INSERT INTO users (name) VALUES ('|username|')}
; perform a safe query with given parameters
print query db .with: ["johndoe"] {!sql SELECT * FROM users WHERE name = ?}