Changes

Jump to navigation Jump to search
670 bytes added ,  18:11, 9 February 2013
(: Execute prepared statement :)
return sql:execute-prepared($prep, $params)
</pre>
 
==SQLite==
The following expression demonstrates how SQLite can be addressed via the SQL Module:
 
<pre class="brush:xquery">
(: Initialize driver :)
sql:init("org.sqlite.JDBC"),
(: Establish a connection :)
let $conn := sql:connect("jdbc:sqlite:database.db")
return (
(: Create a new table :)
sql:execute($conn, "drop table if exists person"),
sql:execute($conn, "create table person (id integer, name string)"),
(: Run 10 updates :)
for $i in 1 to 10
let $q := "insert into person values(" || $i || ", '" || $i || "')"
return sql:execute($conn, $q),
(: Return table contents :)
sql:execute($conn, "select * from person"),
sql:close($conn)
)
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu