initial
This commit is contained in:
166
docs/SQLite3.html
Normal file
166
docs/SQLite3.html
Normal file
@@ -0,0 +1,166 @@
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="logo">
|
||||
<a href="http://github.com/carp-lang/Carp">
|
||||
<img src="logo.png">
|
||||
</a>
|
||||
<div class="title">
|
||||
sqlite3
|
||||
</div>
|
||||
<div class="index">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="SQLite3.html">
|
||||
SQLite3
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h1>
|
||||
SQLite3
|
||||
</h1>
|
||||
<div class="module-description">
|
||||
<p>is a simple high-level wrapper around SQLite3. It doesn’t intend
|
||||
to wrap everything, but it tries to be useful.</p>
|
||||
<h2>Installation</h2>
|
||||
<pre><code class="language-clojure">(load "https://veitheller.de/git/carpentry/sqlite3@0.0.1")
|
||||
</code></pre>
|
||||
<h2>Usage</h2>
|
||||
<p>The module <code>SQLite3</code> provides facilities for opening, closing, and querying
|
||||
databases.</p>
|
||||
<pre><code class="language-clojure">(load "https://veitheller.de/git/carpentry/sqlite3@0.0.1")
|
||||
|
||||
; opening DBs can fail, for the purposes of this example we
|
||||
; ignore that
|
||||
(let-do [db (Result.unsafe-from-success (SQLite3.open "db"))]
|
||||
; we can prepare statements
|
||||
(println* &(SQLite3.query &db "INSERT INTO mytable VALUES (?1, ?2);"
|
||||
&[(to-sqlite3 @"hello") (to-sqlite3 100)]))
|
||||
; and query things
|
||||
(println* &(SQLite3.query &db "SELECT * from mytable;" &[]))
|
||||
(SQLite3.close db)
|
||||
</code></pre>
|
||||
<p>Because <code>open</code> and <code>query</code> return <code>Result</code> types, we could also use
|
||||
combinators!</p>
|
||||
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#SQLite">
|
||||
<h3 id="SQLite">
|
||||
SQLite
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
doc-stub
|
||||
</div>
|
||||
<p class="sig">
|
||||
a
|
||||
</p>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
<p class="doc">
|
||||
<p>is the opaque database type. You’ll need one of those to query
|
||||
anything.</p>
|
||||
<p>It can be obtained by using <a href="#open">open</a>.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#Type">
|
||||
<h3 id="Type">
|
||||
Type
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
module
|
||||
</div>
|
||||
<p class="sig">
|
||||
Module
|
||||
</p>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
<p class="doc">
|
||||
<p>represent all the SQLite types we can represent.</p>
|
||||
<p>The constructors are <code>Null</code>, <code>Integer</code>, <code>Floating</code>, <code>Text</code>, and <code>Blob</code>. Most
|
||||
primitive Carp types can be casted to appropriate SQLite types by using the
|
||||
<code>to-sqlite3</code> interface.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#close">
|
||||
<h3 id="close">
|
||||
close
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
external
|
||||
</div>
|
||||
<p class="sig">
|
||||
(λ [SQLite] ())
|
||||
</p>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
<p class="doc">
|
||||
<p>closes a database.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#open">
|
||||
<h3 id="open">
|
||||
open
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
defn
|
||||
</div>
|
||||
<p class="sig">
|
||||
(λ [&String] (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>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#query">
|
||||
<h3 id="query">
|
||||
query
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
defn
|
||||
</div>
|
||||
<p class="sig">
|
||||
(λ [(Ref SQLite), &String, (Ref (Array Type))] (Result (Array (Array 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>
|
||||
<p>If it fails, we return an error message using <code>Result.Error</code>.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
110
docs/style.css
Normal file
110
docs/style.css
Normal file
@@ -0,0 +1,110 @@
|
||||
html {
|
||||
font-family: "Helvetica", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
font-family: "Hasklig", "Lucida Console", monospace;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
.module-description {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 3em auto auto auto;
|
||||
width: 80%;
|
||||
max-width: 610px;
|
||||
min-width: 400px
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 1em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: 400;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.binder {
|
||||
margin: 0em 0em 3.5em 0em;
|
||||
}
|
||||
|
||||
.sig {
|
||||
font-family: "Hasklig", "Lucida Console", monospace;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
}
|
||||
|
||||
.args {
|
||||
background-color: #eee;
|
||||
display: inline-block;
|
||||
white-space: normal;
|
||||
margin: 0;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-top: 0.3em;
|
||||
font-size: 0.8em;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.huge {
|
||||
font-size: 15em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
/* Smaller screens */
|
||||
@media only screen and (max-width: 600px) {
|
||||
.logo {
|
||||
margin: 1em;
|
||||
text-align: left;
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
.logo img {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
}
|
||||
.content {
|
||||
margin: 0.5em;
|
||||
}
|
||||
.binder {
|
||||
margin: 0em 0em 1.5em 0em;
|
||||
}
|
||||
.sig {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
ul {
|
||||
padding: 0px;
|
||||
}
|
||||
}
|
||||
.title, .index { display: none; }
|
Reference in New Issue
Block a user