fix for newest carp

This commit is contained in:
2022-01-27 11:41:20 +01:00
parent 1b87e7fec1
commit 053d505988
3 changed files with 134 additions and 104 deletions

View File

@@ -6,7 +6,7 @@ everything, but it tries to be useful.
## Installation ## Installation
```clojure ```clojure
(load "https://veitheller.de/git/carpentry/sqlite3@0.0.5") (load "git@git.veitheller.de:carpentry/sqlite3.git@0.0.6")
``` ```
## Usage ## Usage
@@ -15,7 +15,7 @@ The module `SQLite3` provides facilities for opening, closing, and querying
databases. databases.
```clojure ```clojure
(load "https://veitheller.de/git/carpentry/sqlite3@0.0.5") (load "git@git.veitheller.de:carpentry/sqlite3.git@0.0.6")
; opening DBs can fail, for the purposes of this example we ; opening DBs can fail, for the purposes of this example we
; ignore that ; ignore that

View File

@@ -18,26 +18,49 @@
<div class="index"> <div class="index">
<ul> <ul>
<li> <li>
<a href="SQLite3.html"> <details>
SQLite3 <summary>
</a> <a href="SQLite3.html">
SQLite3
</a>
</summary>
<ul>
<li>
<details>
<summary>
<a href="SQLite3.Type.html">
Type
</a>
</summary>
<ul>
<li>
<a href="SQLite3.Type.SQLiteColumn.html">
SQLiteColumn
</a>
</li>
</ul>
</details>
</li>
</ul>
</details>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<h1> <div class="module">
SQLite3 <h1>
</h1> SQLite3
<div class="module-description"> </h1>
<p>is a simple high-level wrapper around SQLite3. It doesnt intend <div class="module-description">
<p>is a simple high-level wrapper around SQLite3. It doesnt intend
to wrap everything, but it tries to be useful.</p> to wrap everything, but it tries to be useful.</p>
<h2>Installation</h2> <h2>Installation</h2>
<pre><code class="language-clojure">(load &quot;https://veitheller.de/git/carpentry/sqlite3@0.0.5&quot;) <pre><code class="language-clojure">(load &quot;git@veitheller.de:git/carpentry/sqlite3.git@0.0.6&quot;)
</code></pre> </code></pre>
<h2>Usage</h2> <h2>Usage</h2>
<p>The module <code>SQLite3</code> provides facilities for opening, closing, and querying <p>The module <code>SQLite3</code> provides facilities for opening, closing, and querying
databases.</p> databases.</p>
<pre><code class="language-clojure">(load &quot;https://veitheller.de/git/carpentry/sqlite3@0.0.5&quot;) <pre><code class="language-clojure">(load &quot;git@veitheller.de:git/carpentry/sqlite3.git@0.0.6&quot;)
; opening DBs can fail, for the purposes of this example we ; opening DBs can fail, for the purposes of this example we
; ignore that ; ignore that
@@ -62,110 +85,113 @@ databases.</p>
<p>Because <code>open</code> and <code>query</code> return <code>Result</code> types, we could also use <p>Because <code>open</code> and <code>query</code> return <code>Result</code> types, we could also use
combinators!</p> combinators!</p>
</div>
<div class="binder">
<a class="anchor" href="#SQLite">
<h3 id="SQLite">
SQLite
</h3>
</a>
<div class="description">
meta-stub
</div> </div>
<p class="sig"> <div class="binder">
a <a class="anchor" href="#SQLite">
</p> <h3 id="SQLite">
<span> SQLite
</h3>
</span> </a>
<p class="doc"> <div class="description">
<p>is the opaque database type. Youll need one of those to query meta-stub
</div>
<p class="sig">
a
</p>
<span>
</span>
<p class="doc">
<p>is the opaque database type. Youll need one of those to query
anything.</p> anything.</p>
<p>It can be obtained by using <a href="#open">open</a>.</p> <p>It can be obtained by using <a href="#open">open</a>.</p>
</p> </p>
</div>
<div class="binder">
<a class="anchor" href="#Type">
<h3 id="Type">
Type
</h3>
</a>
<div class="description">
module
</div> </div>
<p class="sig"> <div class="binder">
Module <a class="anchor" href="#Type">
</p> <h3 id="Type">
<span> <a href="SQLite3.Type.html">
Type
</span> </a>
<p class="doc"> </h3>
</a>
</p> <div class="description">
</div> module
<div class="binder"> </div>
<a class="anchor" href="#close"> <p class="sig">
<h3 id="close"> Module
close </p>
</h3> <span>
</a>
<div class="description"> </span>
external <p class="doc">
</p>
</div> </div>
<p class="sig"> <div class="binder">
(Fn [SQLite] ()) <a class="anchor" href="#close">
</p> <h3 id="close">
<span> close
</h3>
</span> </a>
<p class="doc"> <div class="description">
<p>closes a database.</p> external
</div>
<p class="sig">
(Fn [SQLite] ())
</p>
<span>
</span>
<p class="doc">
<p>closes a database.</p>
</p> </p>
</div>
<div class="binder">
<a class="anchor" href="#open">
<h3 id="open">
open
</h3>
</a>
<div class="description">
defn
</div> </div>
<p class="sig"> <div class="binder">
(Fn [(Ref String a)] (Result SQLite String)) <a class="anchor" href="#open">
</p> <h3 id="open">
<pre class="args"> open
(open s) </h3>
</pre> </a>
<p class="doc"> <div class="description">
<p>opens a database with the filename <code>s</code>.</p> defn
</div>
<p class="sig">
(Fn [(Ref String a)] (Result SQLite String))
</p>
<pre class="args">
(open s)
</pre>
<p class="doc">
<p>opens a database with the filename <code>s</code>.</p>
<p>If it fails, we return an error message using <code>Result.Error</code>.</p> <p>If it fails, we return an error message using <code>Result.Error</code>.</p>
</p> </p>
</div>
<div class="binder">
<a class="anchor" href="#query">
<h3 id="query">
query
</h3>
</a>
<div class="description">
defn
</div> </div>
<p class="sig"> <div class="binder">
(Fn [(Ref SQLite a), (Ref String b), (Ref (Array SQLite3.Type) c)] (Result (Array (Array SQLite3.Type)) String)) <a class="anchor" href="#query">
</p> <h3 id="query">
<pre class="args"> query
(query db s p) </h3>
</pre> </a>
<p class="doc"> <div class="description">
<p>queries the database <code>db</code> using the query <code>s</code> and the parameters defn
</div>
<p class="sig">
(Fn [(Ref SQLite a), (Ref String b), (Ref (Array SQLite3.Type) c)] (Result (Array (Array SQLite3.Type)) String))
</p>
<pre class="args">
(query db s p)
</pre>
<p class="doc">
<p>queries the database <code>db</code> using the query <code>s</code> and the parameters
<code>p</code>.</p> <code>p</code>.</p>
<p>If it fails, we return an error message using <code>Result.Error</code>.</p> <p>If it fails, we return an error message using <code>Result.Error</code>.</p>
</p> </p>
</div>
</div> </div>
</div> </div>
</body> </body>

View File

@@ -7,7 +7,7 @@ to wrap everything, but it tries to be useful.
## Installation ## Installation
```clojure ```clojure
(load \"https://veitheller.de/git/carpentry/sqlite3@0.0.5\") (load \"git@veitheller.de:git/carpentry/sqlite3.git@0.0.6\")
``` ```
## Usage ## Usage
@@ -16,7 +16,7 @@ The module `SQLite3` provides facilities for opening, closing, and querying
databases. databases.
```clojure ```clojure
(load \"https://veitheller.de/git/carpentry/sqlite3@0.0.5\") (load \"git@veitheller.de:git/carpentry/sqlite3.git@0.0.6\")
; opening DBs can fail, for the purposes of this example we ; opening DBs can fail, for the purposes of this example we
; ignore that ; ignore that
@@ -88,6 +88,10 @@ primitive Carp types can be casted to appropriate SQLite types by using the
(register text (Fn [String] SQLiteColumn) "SQLiteColumn_text") (register text (Fn [String] SQLiteColumn) "SQLiteColumn_text")
(register blob (Fn [String] SQLiteColumn) "SQLiteColumn_blob")) (register blob (Fn [String] SQLiteColumn) "SQLiteColumn_blob"))
(defn prn [s]
(SQLite3.Type.str s))
(implements prn SQLite3.Type.prn)
(defn to-sqlite3-internal [x] (defn to-sqlite3-internal [x]
(match x (match x
(Null) (SQLiteColumn.nil) (Null) (SQLiteColumn.nil)